This list is closed, nobody may subscribe to it.
2011 |
Jan
(14) |
Feb
(42) |
Mar
(56) |
Apr
(60) |
May
(54) |
Jun
(48) |
Jul
(74) |
Aug
(52) |
Sep
(68) |
Oct
(64) |
Nov
(42) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(142) |
Feb
(270) |
Mar
(374) |
Apr
(230) |
May
(214) |
Jun
(116) |
Jul
(234) |
Aug
(66) |
Sep
(120) |
Oct
(16) |
Nov
(17) |
Dec
(41) |
2013 |
Jan
(19) |
Feb
(18) |
Mar
(8) |
Apr
(40) |
May
(121) |
Jun
(42) |
Jul
(127) |
Aug
(145) |
Sep
(27) |
Oct
(38) |
Nov
(83) |
Dec
(61) |
2014 |
Jan
(33) |
Feb
(35) |
Mar
(59) |
Apr
(41) |
May
(38) |
Jun
(45) |
Jul
(17) |
Aug
(58) |
Sep
(46) |
Oct
(51) |
Nov
(55) |
Dec
(36) |
2015 |
Jan
(57) |
Feb
(67) |
Mar
(70) |
Apr
(34) |
May
(32) |
Jun
(11) |
Jul
(3) |
Aug
(17) |
Sep
(16) |
Oct
(13) |
Nov
(30) |
Dec
(30) |
2016 |
Jan
(17) |
Feb
(12) |
Mar
(17) |
Apr
(20) |
May
(47) |
Jun
(15) |
Jul
(13) |
Aug
(30) |
Sep
(32) |
Oct
(20) |
Nov
(32) |
Dec
(24) |
2017 |
Jan
(16) |
Feb
|
Mar
(11) |
Apr
(11) |
May
(5) |
Jun
(42) |
Jul
(9) |
Aug
(10) |
Sep
(14) |
Oct
(15) |
Nov
(2) |
Dec
(29) |
2018 |
Jan
(28) |
Feb
(49) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <rc...@us...> - 2016-08-05 18:05:53
|
Revision: 7580 http://sourceforge.net/p/web-erp/reponame/7580 Author: rchacon Date: 2016-08-05 18:05:50 +0000 (Fri, 05 Aug 2016) Log Message: ----------- Fix html code in SuppInvGRNs.php. Modified Paths: -------------- trunk/SuppInvGRNs.php trunk/doc/Change.log Modified: trunk/SuppInvGRNs.php =================================================================== --- trunk/SuppInvGRNs.php 2016-08-05 02:53:30 UTC (rev 7579) +++ trunk/SuppInvGRNs.php 2016-08-05 18:05:50 UTC (rev 7580) @@ -1,7 +1,5 @@ <?php - /* $Id$*/ - /*The supplier transaction uses the SuppTrans class to hold the information about the invoice the SuppTrans class contains an array of GRNs objects - containing details of GRNs for invoicing and also an array of GLCodes objects - only used if the AP - GL link is effective */ @@ -79,7 +77,7 @@ $Hold=True; } } - + if ($InputError==False){ $_SESSION['SuppTrans']->Modify_GRN_To_Trans($_POST['GRNNo'.$i], $_SESSION['SuppTrans']->GRNs[$_POST['GRNNo'.$i]]->PODetailItem, @@ -110,10 +108,10 @@ /*Show all the selected GRNs so far from the SESSION['SuppTrans']->GRNs array */ echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') .'" method="post"> - <table class="selection"> - <tbody> + <table class="selection"> + <thead> <tr> - <th colspan="6"><h3>' . _('Invoiced Goods Received Selected') . '</h3></th> + <th colspan="10"><h3>', _('Invoiced Goods Received Selected'), '</h3></th> </tr> <tr> <th>' . _('Sequence') . ' #</th> @@ -125,7 +123,10 @@ <th>' . _('Order Price') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> <th>' . _('Inv Price') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> <th>' . _('Order Value') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> - </tr>'; + <th> </th> + </tr> + </thead> + <tbody>'; $TotalValueCharged=0; @@ -136,25 +137,24 @@ } else { $DisplayPrice = locale_number_format($EnteredGRN->OrderPrice,4); } - + echo '<tr> - <td>' . $EnteredGRN->GRNNo . '</td> - <td>' . $EnteredGRN->SupplierRef . '</td> - <td>' . $EnteredGRN->ItemCode . '</td> - <td>' . $EnteredGRN->ItemDescription . '</td> - <td class="number">' . locale_number_format($EnteredGRN->QtyRecd - $EnteredGRN->Prev_QuantityInv,'Variable') . '</td> - <td><input type="text" class="number" name="This_QuantityInv' . $i . '" value="' . locale_number_format($EnteredGRN->This_QuantityInv,'Variable') . '" size="11" maxlength="10" /></td> - <td class="number">' . $DisplayPrice . '</td> - <td><input type="text" class="number" name="ChgPrice' . $i . '" value="' . locale_number_format($EnteredGRN->ChgPrice,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" size="11" maxlength="10" /></td> - <td class="number">' . locale_number_format($EnteredGRN->ChgPrice * $EnteredGRN->This_QuantityInv,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> - <td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Delete=' . $EnteredGRN->GRNNo . '">' . _('Delete') . '</a></td> + <td class="number">', $EnteredGRN->GRNNo, '</td> + <td class="text">', $EnteredGRN->SupplierRef, '</td> + <td class="number">', $EnteredGRN->ItemCode, '</td> + <td class="text">', $EnteredGRN->ItemDescription, '</td> + <td class="number">', locale_number_format($EnteredGRN->QtyRecd - $EnteredGRN->Prev_QuantityInv,'Variable'), '</td> + <td class="number"><input class="number" maxlength="10" name="This_QuantityInv', $i, '" size="11" type="text" value="', locale_number_format($EnteredGRN->This_QuantityInv, 'Variable'), '" /></td> + <td class="number">', $DisplayPrice, '</td> + <td class="number"><input class="number" maxlength="10" name="ChgPrice', $i, '" size="11" type="text" value="', locale_number_format($EnteredGRN->ChgPrice, $_SESSION['SuppTrans']->CurrDecimalPlaces), '" /></td> + <td class="number">', locale_number_format($EnteredGRN->ChgPrice * $EnteredGRN->This_QuantityInv, $_SESSION['SuppTrans']->CurrDecimalPlaces), '</td> + <td class="text"><a href="', htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), '?Delete=', $EnteredGRN->GRNNo, '">', _('Delete'), '</a></td> </tr> <input type="hidden" name="GRNNo' . $i . '" . value="' . $EnteredGRN->GRNNo . '" />'; $i++; } echo '</tbody> - </table> <div class="centre"> <p> @@ -253,9 +253,8 @@ </tr> </table> <table> - <tbody> + <thead> <tr> - <th class="ascending">' . _('Select') . '</th> <th class="ascending">' . _('Sequence') . ' #</th> <th class="ascending">' . _('GRN Number') . '</th> <th class="ascending">' . _('Supplier\'s Ref') . '</th> @@ -267,44 +266,43 @@ <th class="ascending">' . _('Qty Yet To Invoice') . '</th> <th class="ascending">' . _('Order Price in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> <th class="ascending">' . _('Line Value in') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th> - </tr>'; + <th class="ascending">' . _('Select'), '</th> + </tr> + </thead> + <tbody>'; $i = 0; $POs = array(); - foreach ($_SESSION['SuppTransTmp']->GRNs as $GRNTmp){ - - $_SESSION['SuppTransTmp']->GRNs[$GRNTmp->GRNNo]->This_QuantityInv = $GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv; - - if (isset($POs[$GRNTmp->PONo]) and $POs[$GRNTmp->PONo] != $GRNTmp->PONo) { - $POs[$GRNTmp->PONo] = $GRNTmp->PONo; + foreach($_SESSION['SuppTransTmp']->GRNs as $GRNTmp) { + $_SESSION['SuppTransTmp']->GRNs[$GRNTmp->GRNNo]->This_QuantityInv = $GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv; + if (isset($POs[$GRNTmp->PONo]) and $POs[$GRNTmp->PONo] != $GRNTmp->PONo) { + $POs[$GRNTmp->PONo] = $GRNTmp->PONo; + echo '<tr> + <td><input type="submit" name="AddPOToTrans" value="' . $GRNTmp->PONo . '" /></td> + <td colspan="3">' . _('Add Whole PO to Invoice') . '</td> + </tr>'; + } echo '<tr> - <td><input type="submit" name="AddPOToTrans" value="' . $GRNTmp->PONo . '" /></td> - <td colspan="3">' . _('Add Whole PO to Invoice') . '</td> - </tr>'; + <td class="number">', $GRNTmp->GRNNo, '</td> + <td class="number">', $GRNTmp->GRNBatchNo, '</td> + <td class="text">', $GRNTmp->SupplierRef, '</td> + <td class="number">', $GRNTmp->PONo, '</td> + <td class="number">', $GRNTmp->ItemCode, '</td> + <td class="text">', $GRNTmp->ItemDescription, '</td> + <td class="number">', locale_number_format($GRNTmp->QtyRecd, $GRNTmp->DecimalPlaces), '</td> + <td class="number">', locale_number_format($GRNTmp->Prev_QuantityInv, $GRNTmp->DecimalPlaces), '</td> + <td class="number">', locale_number_format(($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv), $GRNTmp->DecimalPlaces), '</td> + <td class="number">', locale_number_format($GRNTmp->OrderPrice, $_SESSION['SuppTrans']->CurrDecimalPlaces), '</td> + <td class="number">', locale_number_format($GRNTmp->OrderPrice * ($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv), $_SESSION['SuppTrans']->CurrDecimalPlaces), '</td> + <td class="centre"><input'; + if(isset($_POST['SelectAll'])) { + echo ' checked'; + } + echo 'name=" GRNNo_', $GRNTmp->GRNNo, '" type="checkbox" /></td> + </tr>'; } - - if (isset($_POST['SelectAll'])) { - echo '<tr> - <td><input type="checkbox" checked name="GRNNo_' . $GRNTmp->GRNNo . '" /></td>'; - } else { - echo '<tr> - <td><input type="checkbox" name="GRNNo_' . $GRNTmp->GRNNo . '" /></td>'; - } - echo '<td>' . $GRNTmp->GRNNo . '</td> - <td>' . $GRNTmp->GRNBatchNo . '</td> - <td>' . $GRNTmp->SupplierRef . '</td> - <td>' . $GRNTmp->PONo . '</td> - <td>' . $GRNTmp->ItemCode . '</td> - <td>' . $GRNTmp->ItemDescription . '</td> - <td class="number">' . locale_number_format($GRNTmp->QtyRecd,$GRNTmp->DecimalPlaces) . '</td> - <td class="number">' . locale_number_format($GRNTmp->Prev_QuantityInv,$GRNTmp->DecimalPlaces) . '</td> - <td class="number">' . locale_number_format(($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv),$GRNTmp->DecimalPlaces) . '</td> - <td class="number">' . locale_number_format($GRNTmp->OrderPrice,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_number_format($GRNTmp->OrderPrice * ($GRNTmp->QtyRecd - $GRNTmp->Prev_QuantityInv),$_SESSION['SuppTrans']->CurrDecimalPlaces) . '</td> - </tr></tbody>'; - - } - echo '</table>'; - echo '<br /> + echo '</tbody> + </table> + <br /> <div class="centre"> <input type="submit" name="SelectAll" value="' . _('Select All') . '" /> <input type="submit" name="DeSelectAll" value="' . _('Deselect All') . '" /> @@ -315,6 +313,6 @@ } echo '</div> - </form>'; + </form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-08-05 02:53:30 UTC (rev 7579) +++ trunk/doc/Change.log 2016-08-05 18:05:50 UTC (rev 7580) @@ -1,4 +1,5 @@ webERP Change Log +05/08/16 RChacon: Fix html code in SuppInvGRNs.php. 02/08/16 Exson: Make account inquiry shown directly when GL Code selected or inquiry result is 1 in SelectGLAccount.php. 27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php. 27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update. |
From: <te...@us...> - 2016-08-05 02:53:33
|
Revision: 7579 http://sourceforge.net/p/web-erp/reponame/7579 Author: tehonu Date: 2016-08-05 02:53:30 +0000 (Fri, 05 Aug 2016) Log Message: ----------- Fix variable needing identifier Modified Paths: -------------- trunk/CustomerReceipt.php Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2016-08-02 10:02:32 UTC (rev 7578) +++ trunk/CustomerReceipt.php 2016-08-05 02:53:30 UTC (rev 7579) @@ -1071,8 +1071,8 @@ } -if (isset($_POST['GLEntry']) AND isset($_SESSION['ReceiptBatch'])){ -/* Set up a heading for the transaction entry for a GL Receipt */ +if (isset($_POST['GLEntry']) AND isset($_SESSION['ReceiptBatch' . $identifier])){ + /* Set up a heading for the transaction entry for a GL Receipt */ echo '<br /> <table class="selection"> <tr> |
From: <ex...@us...> - 2016-08-02 10:02:34
|
Revision: 7578 http://sourceforge.net/p/web-erp/reponame/7578 Author: exsonqu Date: 2016-08-02 10:02:32 +0000 (Tue, 02 Aug 2016) Log Message: ----------- 02/08/16 Exson: Make GLJournalInquiry.php workable for all transaction types and printable. Merge Chinese format GL Journal from cncerp. Modified Paths: -------------- trunk/GLJournalInquiry.php trunk/PDFGLJournal.php trunk/includes/PDFStarter.php trunk/includes/tcpdf/include/tcpdf_static.php trunk/sql/mysql/upgrade4.13-4.13.1.sql Added Paths: ----------- trunk/PDFGLJournalCN.php trunk/includes/PDFGLJournalHeaderCN.inc Modified: trunk/GLJournalInquiry.php =================================================================== --- trunk/GLJournalInquiry.php 2016-08-02 06:29:19 UTC (rev 7577) +++ trunk/GLJournalInquiry.php 2016-08-02 10:02:32 UTC (rev 7578) @@ -17,11 +17,28 @@ echo '<table class="selection">'; echo '<tr><th colspan="3">' . _('Selection Criteria') . '</th></tr>'; - $sql = "SELECT typeno FROM systypes WHERE typeid=0"; + $sql = "SELECT typeid,systypes.typeno,typename FROM + systypes INNER JOIN gltrans ON systypes.typeid=gltrans.type + GROUP BY typeid"; $result = DB_query($sql); - $myrow = DB_fetch_array($result); - $MaxJournalNumberUsed = $myrow['typeno']; + if (DB_num_rows($result)>0) { + echo '<tr> + <td>' . _('Transaction Type') . ' </td> + <td> <select name="TransType">'; + while ($myrow = DB_fetch_array($result)) { + if (!isset($MaxJournalNumberUsed)) { + $MaxJournalNumberUsed = $myrow['typeno']; + } else { + $MaxJournalNumberUsed = ($myrow['typeno']>$MaxJournalNumberUsed)?$myrow['typeno']:$MaxJournalNumberUsed; + } + echo '<option value="' . $myrow['typeid'] . '">' . _($myrow['typename']) . '</option>'; + } + echo '</select></td> + </tr>'; + + } + echo '<tr> <td>' . _('Journal Number Range') . ' (' . _('Between') . ' 1 ' . _('and') . ' ' . $MaxJournalNumberUsed . ')</td> <td>' . _('From') . ':'. '<input type="text" class="number" name="NumberFrom" size="10" maxlength="11" value="1" />' . '</td> @@ -64,7 +81,7 @@ ON gltrans.account=chartmaster.accountcode LEFT JOIN tags ON gltrans.tag=tags.tagref - WHERE gltrans.type='0' + WHERE gltrans.type='" . $_POST['TransType'] . "' AND gltrans.trandate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' AND gltrans.trandate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' AND gltrans.typeno>='" . $_POST['NumberFrom'] . "' @@ -87,7 +104,7 @@ </tr>'; $LastJournal = 0; - + $i = 0; while ($myrow = DB_fetch_array($result)){ if ($myrow['tag']==0) { @@ -95,12 +112,21 @@ } if ($myrow['typeno']!=$LastJournal) { - echo '<tr><td colspan="8"</td></tr><tr> + if ($i == 0) { + $RowClass = 'class="OddTableRows"'; + $i = 1; + } else { + $RowClass = 'class="EvenTableRows"'; + $i = 0; + } + + echo '<tr ' . $RowClass . '><td colspan="8"></td></tr><tr> + <tr ' . $RowClass . '> <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td class="number">' . $myrow['typeno'] . '</td>'; } else { - echo '<tr><td colspan="2"></td>'; + echo '<tr ' . $RowClass . '><td colspan="2"></td>'; } // if user is allowed to see the account we show it, other wise we show "OTHERS ACCOUNTS" @@ -125,9 +151,15 @@ <td class="number">' . locale_number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . $myrow['tag'] . ' - ' . $myrow['tagdescription'] . '</td>'; - if ($myrow['typeno']!=$LastJournal) { - echo '<td class="number"><a href="PDFGLJournal.php?JournalNo='.$myrow['typeno'].'">' . _('Print') . '</a></td></tr>'; - + if ($myrow['typeno']!=$LastJournal AND $CheckRow[0]>0) { + if ($_SESSION['Language'] == 'zh_CN.utf8' OR $_SESSION['Language'] =='zh_hk.utf8') { + echo '<td class="number"><a href="PDFGLJournalCN.php?JournalNo='.$myrow['typeno'].'&Type=' . $_POST['TransType'] . '">' . _('Print') . '</a></td></tr>'; + } else { + echo '<td class="number"><a href="PDFGLJournal.php?JournalNo='.$myrow['typeno'].'">' . _('Print') . '</a></td></tr>'; + } + + + $LastJournal = $myrow['typeno']; } else { echo '<td colspan="1"></td></tr>'; @@ -144,4 +176,4 @@ } include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/PDFGLJournal.php =================================================================== --- trunk/PDFGLJournal.php 2016-08-02 06:29:19 UTC (rev 7577) +++ trunk/PDFGLJournal.php 2016-08-02 10:02:32 UTC (rev 7578) @@ -8,11 +8,18 @@ if (isset($_POST['JournalNo'])) { $JournalNo=$_POST['JournalNo']; + $Type = $_POST['Type']; } else if (isset($_GET['JournalNo'])) { $JournalNo=$_GET['JournalNo']; + $Type = $_GET['Type']; } else { $JournalNo=''; } +if (empty($JournalNo) OR empty($Type)) { + prnMsg(_('This page should be called with Journal No and Type'),'error'); + include('includes/footer.inc'); + exit; +} if ($JournalNo=='Preview') { $FormDesign = simplexml_load_file(sys_get_temp_dir().'/Journal.xml'); @@ -44,8 +51,9 @@ ON gltrans.account=chartmaster.accountcode LEFT JOIN tags ON gltrans.tag=tags.tagref - WHERE gltrans.type='0' + WHERE gltrans.type='" . $Type . "' AND gltrans.typeno='" . $JournalNo . "'"; + $result=DB_query($sql); $LineCount = DB_num_rows($result); // UldisN $myrow=DB_fetch_array($result); @@ -104,4 +112,4 @@ $pdf->OutputD($_SESSION['DatabaseName'] . '_Journal_' . date('Y-m-d').'.pdf');//UldisN $pdf->__destruct(); //UldisN } -?> \ No newline at end of file +?> Added: trunk/PDFGLJournalCN.php =================================================================== --- trunk/PDFGLJournalCN.php (rev 0) +++ trunk/PDFGLJournalCN.php 2016-08-02 10:02:32 UTC (rev 7578) @@ -0,0 +1,156 @@ +<?php /* $Id$*/ + +/* $Revision: 1.5 $2012.2CQZ二次修改 */ + +include('includes/session.inc'); +if (isset($_POST['JournalNo'])) { + $JournalNo=$_POST['JournalNo']; + $TypeID=$_POST['Type']; +} else if (isset($_GET['JournalNo'])) { + $JournalNo=$_GET['JournalNo']; + $TypeID=$_GET['Type']; +} else { + $JournalNo=''; + $TypeID=''; +} +if ($JournalNo=='Preview') { + $FormDesign = simplexml_load_file(sys_get_temp_dir().'/Journalc.xml'); +} else { + $FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/Journalc.xml'); +} + +// Set the paper size/orintation +$PaperSize = $FormDesign->PaperSize; +$PageNumber=1; +$line_height=$FormDesign->LineHeight; +include('includes/PDFStarter.php'); +$pdf->addInfo('Title', _('中国(甲式10)会计凭证') ); +$pdf->addInfo('Author','webERP ' . 'CQZ二次修改'); +$pdf->addInfo('Subject',_('会计凭证——中国式会计凭证--登录ERP打印或下载此凭证的用户:').$_SESSION['UsersRealName']); +$pdf->SetProtection(array('modify','copy','annot-forms'), ''); + +if ($JournalNo=='Preview') { + $LineCount = 2; // UldisN +} else { + $sql="SELECT gltrans.type, + gltrans.typeno, + gltrans.trandate, + gltrans.account, + systypes.typename, + chartmaster.accountname, + gltrans.narrative, + gltrans.amount, + gltrans.tag, + tags.tagdescription, + gltrans.jobref + FROM gltrans + INNER JOIN chartmaster + ON gltrans.account=chartmaster.accountcode + INNER JOIN systypes + ON gltrans.type=systypes.typeid + LEFT JOIN tags + ON gltrans.tag=tags.tagref + WHERE gltrans.type='".$TypeID."' + AND gltrans.typeno='" . $JournalNo . "'"; + $result=DB_query($sql); + $LineCount = DB_num_rows($result); // UldisN + $myrow=DB_fetch_array($result); + $JournalDate=$myrow['trandate']; + DB_data_seek($result, 0); + $Typemame=$myrow['typename']; + include('includes/PDFGLJournalHeaderCN.inc'); +} +$counter=1; +$YPos=$FormDesign->Data->y; +while ($counter<=$LineCount) { + if ($JournalNo=='Preview') { + $AccountCode=str_pad('',10,'x'); + $Date='1/1/1900'; + $Description=str_pad('',30,'x'); + $Narrative=str_pad('',30,'x'); + $Amount='XXXX.XX'; + $Tag=str_pad('',25,'x'); + $JobRef=str_pad('',25,'x'); + } else { + $myrow=DB_fetch_array($result); + if ($myrow['tag']==0) { + $myrow['tagdescription']='None'; + } + $AccountCode = $myrow['account']; + $Description = $myrow['accountname']; + $Date = $myrow['trandate']; + $Narrative = $myrow['narrative']; + $Amount = $myrow['amount']; + $Tag = $myrow['tag'].' - '.$myrow['tagdescription']; + $JobRef = $myrow['jobref']; + } + + if ( $myrow['amount'] > 0) { + $DebitAmount = locale_number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']); + $DebitTotal += $myrow['amount']; + $CreditAmount = ' '; + } else { + $CreditAmount = locale_number_format(-$myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']); + $CreditTotal += $myrow['amount']; + $DebitAmount = ' '; + } + $pdf->SetTextColor(0,0,0); + if((mb_strlen($Narrative,'GB2312')+ substr_count($Narrative," "))>40){ + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x+3,$Page_Height-$YPos-5,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $Narrative); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x+3,$Page_Height-$YPos+3,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $AccountCode); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x+3,$Page_Height-$YPos+3,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $Description); + }else{ + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x+3,$Page_Height-$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $Narrative); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x+3,$Page_Height-$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $AccountCode); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x+3,$Page_Height-$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $Description); + } + $pdf->SetFont('helvetica', '', 10); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x+3,$Page_Height-$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize,$DebitAmount , 'right'); + + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x+3,$Page_Height-$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize, $CreditAmount, 'right'); + + + $YPos += $line_height; + $counter++; + + $DebitTotal1=locale_number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces'], 'right'); + $CreditTotal1=locale_number_format(-$CreditTotal,$_SESSION['CompanyRecord']['decimalplaces'], 'right'); + + $pdf->SetFont('javiergb', '', 10); + + if ($YPos >= $FormDesign->LineAboveFooter->starty){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + $YPos=$FormDesign->Data->y; + include ('includes/PDFGLJournalHeaderCN.inc'); + } +} +$pdf->setlineStyle(array('width'=>0.8)); +$pdf->SetLineStyle(array('color'=>array(0,0,0))); +$pdf->Line($XPos=540, $Page_Height-$YPos+15, $FormDesign->Column33->endx,$Page_Height - $FormDesign->Column33->endy); + +//end if need a new page headed up + + +//$pdf->addJpegFromFile('hjje.jpg',$FormDesign->Headings->Column7->x+3+20,$Page_Height - 282,110,28); +$pdf->SetTextColor(0,0,255); +$pdf->addText($FormDesign->Headings->Column7->x+3,$Page_Height-$FormDesign->Headings->Column7->y,$FormDesign->Headings->Column7->FontSize, _('合 计 金 额'));//$FormDesign->Headings->Column7->name +$pdf->SetTextColor(0,0,0); +$pdf->SetFont('helvetica', '', 10); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column8->x+3,$Page_Height - $FormDesign->Headings->Column8->y, $FormDesign->Headings->Column8->Length,$FormDesign->Headings->Column8->FontSize, $DebitTotal1, 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column9->x+3,$Page_Height - $FormDesign->Headings->Column9->y, $FormDesign->Headings->Column9->Length,$FormDesign->Headings->Column9->FontSize, $CreditTotal1, 'right'); +$pdf->SetFont('javiergb', '', 10); + +if ($LineCount == 0) { //UldisN + $title = _('GRN Error'); + include('includes/header.inc'); + prnMsg(_('There were no GRN to print'),'warn'); + echo '<br /><a href="'.$rootpath.'/index.php">'. _('Back to the menu').'</a>'; + include('includes/footer.inc'); + exit; +} else { + $pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN +} +?> + Added: trunk/includes/PDFGLJournalHeaderCN.inc =================================================================== --- trunk/includes/PDFGLJournalHeaderCN.inc (rev 0) +++ trunk/includes/PDFGLJournalHeaderCN.inc 2016-08-02 10:02:32 UTC (rev 7578) @@ -0,0 +1,124 @@ +<?php +/* $Id$*/ +/*PDF page header for price list report */ +if ($PageNumber>1){ + $pdf->newPage(); +} + +$pdf->addJpegFromFile($_SESSION['LogoFile'] ,$FormDesign->logo->x+3,$Page_Height-$FormDesign->logo->y,$FormDesign->logo->width,$FormDesign->logo->height); +$pdf->SetTextColor(0,0,255); +$LeftOvers = $pdf->addText($FormDesign->CompanyName->x+3,$Page_Height-$FormDesign->CompanyName->y,$FormDesign->CompanyName->FontSize,$_SESSION['CompanyRecord']['coyname']); +$LeftOvers = $pdf->addText($FormDesign->GRNNumber2->x+3,$Page_Height-$FormDesign->GRNNumber2->y,$FormDesign->GRNNumber2->FontSize, '凭证类型:'.$Typemame,'right' ); +$JournalNo=str_pad($JournalNo, 9, '0', STR_PAD_LEFT); +$LeftOvers = $pdf->addText($FormDesign->GRNNumber->x+3,$Page_Height-$FormDesign->GRNNumber->y,$FormDesign->GRNNumber->FontSize, '凭证编号:'.$JournalNo,'right' ); +$LeftOvers = $pdf->addText($FormDesign->OrderNumber->x+3,$Page_Height-$FormDesign->OrderNumber->y,$FormDesign->OrderNumber->FontSize, '记 账 凭 证 '); +$LeftOvers = $pdf->addText($FormDesign->PrintDate->x+3,$Page_Height-$FormDesign->PrintDate->y,$FormDesign->PrintDate->FontSize, _('Printed').':' . Date($_SESSION['DefaultDateFormat']), 'right'); +$pdf->setlineStyle(array('width'=>1.2)); +$pdf->SetLineStyle(array('color'=>array(0,0,255))); +/*Draw a rectangle to put the headings in */ +$pdf->Rectangle($FormDesign->HeaderRectangle->x+3, $Page_Height - $FormDesign->HeaderRectangle->y, $FormDesign->HeaderRectangle->width,$FormDesign->HeaderRectangle->height); + +/*set up the headings */ +$LeftOvers = $pdf->addText($FormDesign->Headings->Column1->x+3,$Page_Height - $FormDesign->Headings->Column1->y, $FormDesign->Headings->Column1->FontSize, '摘 要'); +$LeftOvers = $pdf->addText($FormDesign->Headings->Column2->x+3,$Page_Height - $FormDesign->Headings->Column2->y, $FormDesign->Headings->Column2->FontSize, '科目代码'); +$LeftOvers = $pdf->addText($FormDesign->Headings->Column3->x+3,$Page_Height - $FormDesign->Headings->Column3->y, $FormDesign->Headings->Column3->FontSize, '科目名称'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column4->x+3,$Page_Height - $FormDesign->Headings->Column4->y, $FormDesign->Headings->Column4->Length,$FormDesign->Headings->Column4->FontSize, '借方金额 贷方金额', 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column5->x+3,$Page_Height - $FormDesign->Headings->Column5->y, $FormDesign->Headings->Column5->Length,$FormDesign->Headings->Column5->FontSize, '千百十万千.百十元角分', 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column6->x+3,$Page_Height - $FormDesign->Headings->Column6->y, $FormDesign->Headings->Column6->Length,$FormDesign->Headings->Column6->FontSize, '千百十万千.百十元角分', 'right'); + + + +$LeftOvers = $pdf->addText($FormDesign->ReceiptDate->x+3,$Page_Height-$FormDesign->ReceiptDate->y,$FormDesign->ReceiptDate->FontSize, '记账日期: '.ConvertSQLDate($JournalDate)); + +$tmpX=$FormDesign->SignedFor->x+3; +$tmpY=$Page_Height-$FormDesign->SignedFor->y; +$tmpFz=$FormDesign->SignedFor->FontSize; +$LeftOvers = $pdf->addText($tmpX,$tmpY,$tmpFz, '会计主管:'); +$LeftOvers = $pdf->addText($tmpX+220,$tmpY,$tmpFz, '复核:'); +$LeftOvers = $pdf->addText($tmpX+405,$tmpY,$tmpFz, '制单:'); + +if ($JournalNo=='Preview') { + $realname = 'cncerp'; +} else { + //list($userid,$realname,$stepdate)=getTransBy($TypeID,$JournalNo);// +} +$pdf->addText($tmpX+430,$tmpY,$tmpFz, $realname); + +$pdf->addText($tmpX+50,$tmpY,$tmpFz, ''); +$pdf->addText($tmpX+250,$tmpY,$tmpFz, ''); +$pdf->addText($tmpX+335,$tmpY,$tmpFz, ''); +$pdf->addText($tmpX+450,$tmpY,$tmpFz, ''); + +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column7->x+3,$Page_Height - $FormDesign->Headings->Column7->y, $FormDesign->Headings->Column7->Length,$FormDesign->Headings->Column7->FontSize, '过次页', 'right'); +/*Draw a rectangle to put the data in */ +$pdf->setlineStyle(array('width'=>1.2)); +$pdf->Rectangle($FormDesign->DataRectangle->x+3, $Page_Height - $FormDesign->DataRectangle->y, $FormDesign->DataRectangle->width,$FormDesign->DataRectangle->height); +$pdf->setlineStyle(array('width'=>0.2)); +$pdf->Line($FormDesign->LineAboveFooter->startx, $Page_Height - $FormDesign->LineAboveFooter->starty, $FormDesign->LineAboveFooter->endx,$Page_Height - $FormDesign->LineAboveFooter->endy); + +$pdf->setlineStyle(array('width'=>0.2)); +$pdf->Line($FormDesign->Column1->startx, $Page_Height - $FormDesign->Column1->starty, $FormDesign->Column1->endx,$Page_Height - $FormDesign->Column1->endy); +$pdf->Line($FormDesign->Column2->startx, $Page_Height - $FormDesign->Column2->starty, $FormDesign->Column2->endx,$Page_Height - $FormDesign->Column2->endy); +$pdf->Line($FormDesign->Column3->startx, $Page_Height - $FormDesign->Column3->starty, $FormDesign->Column3->endx,$Page_Height - $FormDesign->Column3->endy); +$pdf->Line($FormDesign->Column4->startx, $Page_Height - $FormDesign->Column4->starty, $FormDesign->Column4->endx,$Page_Height - $FormDesign->Column4->endy); +$pdf->Line($FormDesign->Column5->startx, $Page_Height - $FormDesign->Column5->starty, $FormDesign->Column5->endx,$Page_Height - $FormDesign->Column5->endy); +$pdf->setlineStyle(array('width'=>1.2)); + +$pdf->Line($FormDesign->Column6->startx, $Page_Height - $FormDesign->Column6->starty, $FormDesign->Column6->endx,$Page_Height - $FormDesign->Column6->endy); +$pdf->setlineStyle(array('width'=>0.2)); + +$pdf->Line($FormDesign->Column7->startx, $Page_Height - $FormDesign->Column7->starty, $FormDesign->Column7->endx,$Page_Height - $FormDesign->Column7->endy); +$pdf->Line($FormDesign->Column8->startx, $Page_Height - $FormDesign->Column8->starty, $FormDesign->Column8->endx,$Page_Height - $FormDesign->Column8->endy); +$pdf->setlineStyle(array('width'=>1.2)); + +$pdf->Line($FormDesign->Column9->startx, $Page_Height - $FormDesign->Column9->starty, $FormDesign->Column9->endx,$Page_Height - $FormDesign->Column9->endy); +$pdf->setlineStyle(array('width'=>0.2)); + +$pdf->Line($FormDesign->Column10->startx, $Page_Height - $FormDesign->Column10->starty, $FormDesign->Column10->endx,$Page_Height - $FormDesign->Column10->endy); +$pdf->Line($FormDesign->Column11->startx, $Page_Height - $FormDesign->Column11->starty, $FormDesign->Column11->endx,$Page_Height - $FormDesign->Column11->endy); +$pdf->setlineStyle(array('width'=>1.2)); +$pdf->SetLineStyle(array('color'=>array(255,50,0))); +$pdf->Line($FormDesign->Column12->startx, $Page_Height - $FormDesign->Column12->starty, $FormDesign->Column12->endx,$Page_Height - $FormDesign->Column12->endy); +$pdf->setlineStyle(array('width'=>0.2)); +$pdf->SetLineStyle(array('color'=>array(0,0,255))); +$pdf->Line($FormDesign->Column13->startx, $Page_Height - $FormDesign->Column13->starty, $FormDesign->Column13->endx,$Page_Height - $FormDesign->Column13->endy); +$pdf->Line($FormDesign->Column14->startx, $Page_Height - $FormDesign->Column14->starty, $FormDesign->Column14->endx,$Page_Height - $FormDesign->Column14->endy); +$pdf->Line($FormDesign->Column15->startx, $Page_Height - $FormDesign->Column15->starty, $FormDesign->Column15->endx,$Page_Height - $FormDesign->Column15->endy); +$pdf->Line($FormDesign->Column16->startx, $Page_Height - $FormDesign->Column16->starty, $FormDesign->Column16->endx,$Page_Height - $FormDesign->Column16->endy); +$pdf->setlineStyle(array('width'=>1.2)); + +$pdf->Line($FormDesign->Column17->startx, $Page_Height - $FormDesign->Column17->starty, $FormDesign->Column17->endx,$Page_Height - $FormDesign->Column17->endy); +$pdf->setlineStyle(array('width'=>0.2)); + +$pdf->Line($FormDesign->Column18->startx, $Page_Height - $FormDesign->Column18->starty, $FormDesign->Column18->endx,$Page_Height - $FormDesign->Column18->endy); +$pdf->Line($FormDesign->Column19->startx, $Page_Height - $FormDesign->Column19->starty, $FormDesign->Column19->endx,$Page_Height - $FormDesign->Column19->endy); +$pdf->setlineStyle(array('width'=>1.2)); + +$pdf->Line($FormDesign->Column20->startx, $Page_Height - $FormDesign->Column20->starty, $FormDesign->Column20->endx,$Page_Height - $FormDesign->Column20->endy); +$pdf->setlineStyle(array('width'=>0.2)); + +$pdf->Line($FormDesign->Column21->startx, $Page_Height - $FormDesign->Column21->starty, $FormDesign->Column21->endx,$Page_Height - $FormDesign->Column21->endy); +$pdf->Line($FormDesign->Column22->startx, $Page_Height - $FormDesign->Column22->starty, $FormDesign->Column22->endx,$Page_Height - $FormDesign->Column22->endy); +$pdf->setlineStyle(array('width'=>1.2)); +$pdf->SetLineStyle(array('color'=>array(255,50,0))); +$pdf->Line($FormDesign->Column23->startx, $Page_Height - $FormDesign->Column23->starty, $FormDesign->Column23->endx,$Page_Height - $FormDesign->Column23->endy); +$pdf->setlineStyle(array('width'=>0.2)); +$pdf->SetLineStyle(array('color'=>array(0,0,255))); +$pdf->Line($FormDesign->Column24->startx, $Page_Height - $FormDesign->Column24->starty, $FormDesign->Column24->endx,$Page_Height - $FormDesign->Column24->endy); + +$pdf->Line($FormDesign->Column25->startx, $Page_Height - $FormDesign->Column25->starty, $FormDesign->Column25->endx,$Page_Height - $FormDesign->Column25->endy); +$pdf->Line($FormDesign->Column26->startx, $Page_Height - $FormDesign->Column26->starty, $FormDesign->Column26->endx,$Page_Height - $FormDesign->Column26->endy); +$pdf->Line($FormDesign->Column27->startx, $Page_Height - $FormDesign->Column27->starty, $FormDesign->Column27->endx,$Page_Height - $FormDesign->Column27->endy); +$pdf->Line($FormDesign->Column28->startx, $Page_Height - $FormDesign->Column28->starty, $FormDesign->Column28->endx,$Page_Height - $FormDesign->Column28->endy); +$pdf->Line($FormDesign->Column29->startx, $Page_Height - $FormDesign->Column29->starty, $FormDesign->Column29->endx,$Page_Height - $FormDesign->Column29->endy); +$pdf->Line($FormDesign->Column30->startx, $Page_Height - $FormDesign->Column30->starty, $FormDesign->Column30->endx,$Page_Height - $FormDesign->Column30->endy); +$pdf->Line($FormDesign->Column31->startx, $Page_Height - $FormDesign->Column31->starty, $FormDesign->Column31->endx,$Page_Height - $FormDesign->Column31->endy); +$pdf->Line($FormDesign->Column32->startx, $Page_Height - $FormDesign->Column32->starty, $FormDesign->Column32->endx,$Page_Height - $FormDesign->Column32->endy); +$pdf->Line($FormDesign->Column34->startx, $Page_Height - $FormDesign->Column34->starty, $FormDesign->Column34->endx,$Page_Height - $FormDesign->Column34->endy); +$pdf->Line($FormDesign->Column35->startx, $Page_Height - $FormDesign->Column35->starty, $FormDesign->Column35->endx,$Page_Height - $FormDesign->Column35->endy); + +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column10->x+3,$Page_Height - $FormDesign->Headings->Column10->y, $FormDesign->Headings->Column10->Length,$FormDesign->Headings->Column10->FontSize, '附', 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column11->x+3,$Page_Height - $FormDesign->Headings->Column11->y, $FormDesign->Headings->Column11->Length,$FormDesign->Headings->Column11->FontSize, '件', 'right'); +$LeftOvers = $pdf->addTextWrap($FormDesign->Headings->Column12->x+3,$Page_Height - $FormDesign->Headings->Column12->y, $FormDesign->Headings->Column12->Length,$FormDesign->Headings->Column12->FontSize, '张', 'right'); +$PageNumber++; +?> Modified: trunk/includes/PDFStarter.php =================================================================== --- trunk/includes/PDFStarter.php 2016-08-02 06:29:19 UTC (rev 7577) +++ trunk/includes/PDFStarter.php 2016-08-02 10:02:32 UTC (rev 7578) @@ -108,7 +108,20 @@ $Left_Margin=50; $Right_Margin=40; break; + + case 'P/3/A4_pingzheng': + $DocumentPaper = 'Z2'; + $DocumentOrientation ='L'; + + $Page_Width=595; + $Page_Height=320; + $Top_Margin=10; + $Bottom_Margin=10; + $Left_Margin=20; + $Right_Margin=10; + break; + case 'Letter': // 216mm x 279mm $DocumentPaper = 'LETTER'; Modified: trunk/includes/tcpdf/include/tcpdf_static.php =================================================================== --- trunk/includes/tcpdf/include/tcpdf_static.php 2016-08-02 06:29:19 UTC (rev 7577) +++ trunk/includes/tcpdf/include/tcpdf_static.php 2016-08-02 10:02:32 UTC (rev 7578) @@ -823,6 +823,7 @@ case 'FR_COURONNE' : {$pf = array( 1020.472, 1303.937); break;} case 'FR_TELLIERE' : {$pf = array( 963.780, 1247.244); break;} case 'FR_POT' : {$pf = array( 878.740, 1133.858); break;} + case 'Z2' : {$pf = array( 560.80,320.76); break;} // DEFAULT ISO A4 default: {$pf = array( 595.276, 841.890); break;} } @@ -2840,4 +2841,4 @@ //============================================================+ // END OF FILE //============================================================+ -?> \ No newline at end of file +?> Modified: trunk/sql/mysql/upgrade4.13-4.13.1.sql =================================================================== --- trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-02 06:29:19 UTC (rev 7577) +++ trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-08-02 10:02:32 UTC (rev 7578) @@ -1,5 +1,6 @@ INSERT INTO scripts VALUES ('InternalStockRequestInquiry.php',1,'Internal Stock Request inquiry'); ALTER table stockrequest ADD initiator varchar(20) NOT NULL DEFAULT ''; INSERT INTO securitytokens VALUES (19,'Internal stock request fully access authority'); +INSERT INTO scripts VALUES ('PDFGLJournalCN.php',1,'Print GL Journal Chinese version'); |
From: <ex...@us...> - 2016-08-02 06:29:21
|
Revision: 7577 http://sourceforge.net/p/web-erp/reponame/7577 Author: exsonqu Date: 2016-08-02 06:29:19 +0000 (Tue, 02 Aug 2016) Log Message: ----------- 02/08/16 Exson: Make account inquiry shown directly when GL Code selected or inquiry result is 1 in SelectGLAccount.php. Modified Paths: -------------- trunk/SelectGLAccount.php trunk/doc/Change.log Modified: trunk/SelectGLAccount.php =================================================================== --- trunk/SelectGLAccount.php 2016-07-27 10:10:03 UTC (rev 7576) +++ trunk/SelectGLAccount.php 2016-08-02 06:29:19 UTC (rev 7577) @@ -52,6 +52,10 @@ chartmaster.accountcode"; } elseif (mb_strlen($_POST['GLCode'])>0){ + if (!empty($_POST['GLCode'])) { + header('location:' . $RootPath . '/GLAccountInquiry.php?Account=' . $_POST['GLCode'] . '&Show=Yes'); + exit; + } $SQL = "SELECT chartmaster.accountcode, chartmaster.accountname, @@ -69,6 +73,11 @@ } if (isset($SQL) and $SQL!=''){ $result = DB_query($SQL); + if (DB_num_rows($result) == 1) { + $AccountRow = DB_fetch_row($result); + header('location:' . $RootPath . '/GLAccountInquiry.php?Account=' . $AccountRow[0] . '&Show=Yes'); + exit; + } } } //end of if search @@ -178,4 +187,4 @@ } //end AccountID already selected include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-27 10:10:03 UTC (rev 7576) +++ trunk/doc/Change.log 2016-08-02 06:29:19 UTC (rev 7577) @@ -1,5 +1,5 @@ webERP Change Log - +02/08/16 Exson: Make account inquiry shown directly when GL Code selected or inquiry result is 1 in SelectGLAccount.php. 27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php. 27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update. 27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php. |
From: <ex...@us...> - 2016-07-27 10:10:06
|
Revision: 7576 http://sourceforge.net/p/web-erp/reponame/7576 Author: exsonqu Date: 2016-07-27 10:10:03 +0000 (Wed, 27 Jul 2016) Log Message: ----------- 27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php Modified Paths: -------------- trunk/WorkOrderCosting.php trunk/WorkOrderIssue.php trunk/doc/Change.log Modified: trunk/WorkOrderCosting.php =================================================================== --- trunk/WorkOrderCosting.php 2016-07-27 09:27:05 UTC (rev 7575) +++ trunk/WorkOrderCosting.php 2016-07-27 10:10:03 UTC (rev 7576) @@ -413,14 +413,18 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); } + if ($TotalOnHand>0) {//to avoid negative quantity make cost data abnormal + $NewCost = $WORow['currcost'] +(-$TotalVariance * $ShareProportion *$ProportionOnHand)/$TotalOnHand; + } else { + $NewCost = $WORow['currcost']; + } - $NewCost = $WORow['currcost'] +(-$TotalVariance * $ShareProportion *$ProportionOnHand)/$TotalOnHand; - $SQL = "UPDATE stockmaster SET materialcost='" . $NewCost . "', labourcost=0, overheadcost=0, - lastcost='" . $WORow['currcost'] . "' + lastcost='" . $WORow['currcost'] . "', + lastcostupdate = '" . Date('Y-m-d') . "' WHERE stockid='" . $WORow['stockid'] . "'"; $ErrMsg = _('The cost details for the stock item could not be updated because'); @@ -515,9 +519,9 @@ } // end loop around the items on the work order $CloseWOResult =DB_query("UPDATE workorders SET closed=1, closecomments = '". $_POST['CloseComments'] ."' WHERE wo='" .$_POST['WO'] . "'", - _('Could not update the work order to closed because:'), - _('The SQL used to close the work order was:'), - true); + _('Could not update the work order to closed because:'), + _('The SQL used to close the work order was:'), + true); $DeleteAnyWOSerialNos = DB_query("DELETE FROM woserialnos WHERE wo='" . $_POST['WO'] . "'", _('Could not delete the predefined work order serial numbers'), _('The SQL used to delete the predefined serial numbers was:'), @@ -550,7 +554,6 @@ echo '<tr> <td colspan="9"> - <div class="centre"> <textarea ' . $ReadOnly . ' style="width:100%" rows="5" cols="80" name="CloseComments" >' . $_POST['CloseComments'] . '</textarea> </div> Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2016-07-27 09:27:05 UTC (rev 7575) +++ trunk/WorkOrderIssue.php 2016-07-27 10:10:03 UTC (rev 7576) @@ -87,10 +87,10 @@ $Result = DB_query($SQL); $IssueItemRow = DB_fetch_array($Result); //now lets get the decimalplaces needed - if ($IssueItemRow['decimalplaces'] <=4) { + if ($IssueItemRow['decimalplaces'] <=3) { $VarianceAllowed = 0.0001; } else { - $VarianceAllowed = pow(10,-$IssueItemRow['decimalplaces']); + $VarianceAllowed = pow(10,-(1+$IssueItemRow['decimalplaces'])); } $QuantityIssued =0; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-27 09:27:05 UTC (rev 7575) +++ trunk/doc/Change.log 2016-07-27 10:10:03 UTC (rev 7576) @@ -1,4 +1,6 @@ webERP Change Log + +27/07/16 Exson: Add cost update date for material cost in WorkOrderCosting.php and WorkOrderIssue.php. 27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update. 27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php. 27/07/16 Exson: Add error proof to avoid a blank credit note issued without any items credited or freight charge input in Credit_Invoice.php. |
From: <ex...@us...> - 2016-07-27 09:27:08
|
Revision: 7575 http://sourceforge.net/p/web-erp/reponame/7575 Author: exsonqu Date: 2016-07-27 09:27:05 +0000 (Wed, 27 Jul 2016) Log Message: ----------- 27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update. Modified Paths: -------------- trunk/Credit_Invoice.php trunk/doc/Change.log Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2016-07-27 07:19:16 UTC (rev 7574) +++ trunk/Credit_Invoice.php 2016-07-27 09:27:05 UTC (rev 7575) @@ -230,7 +230,7 @@ if(isset($_POST['ChargeFreightCost'])) { $_SESSION['CreditItems' . $identifier]->FreightCost = filter_number_format($_POST['ChargeFreightCost']); - if (($TotalQtyCredit + abs($_POST['ChargeFreightCost']))<=0) { + if (($TotalQtyCredited + abs($_POST['ChargeFreightCost']))<=0) { prnMsg(_('There are no item quantity or freight charge input'),'error'); if (isset($_POST['ProcessCredit'])) { unset($_POST['ProcessCredit']); Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-27 07:19:16 UTC (rev 7574) +++ trunk/doc/Change.log 2016-07-27 09:27:05 UTC (rev 7575) @@ -1,5 +1,5 @@ webERP Change Log - +27/07/16 Exson: Fixed the typo in Credit_Invoice.php introduced in previous update. 27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php. 27/07/16 Exson: Add error proof to avoid a blank credit note issued without any items credited or freight charge input in Credit_Invoice.php. 25/07/16 Exson: Add InternalStockRequestInquiry.php script. |
From: <ex...@us...> - 2016-07-27 07:19:18
|
Revision: 7574 http://sourceforge.net/p/web-erp/reponame/7574 Author: exsonqu Date: 2016-07-27 07:19:16 +0000 (Wed, 27 Jul 2016) Log Message: ----------- 27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php. Modified Paths: -------------- trunk/SelectOrderItems.php trunk/doc/Change.log Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2016-07-27 07:03:27 UTC (rev 7573) +++ trunk/SelectOrderItems.php 2016-07-27 07:19:16 UTC (rev 7574) @@ -1025,7 +1025,11 @@ /*There is a new price being input for the line item */ $Price = filter_number_format($_POST['Price_' . $OrderLine->LineNumber]); + if ($_POST['Discount_' . $OrderLine->LineNumber] < 100) {//to avoid divided by zero error $_POST['GPPercent_' . $OrderLine->LineNumber] = (($Price*(1-(filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100))) - $OrderLine->StandardCost*$ExRate)/($Price *(1-filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])/100)/100); + } else { + $_POST['GPPercent_' . $OrderLine->LineNumber] = 0; + } } elseif (ABS($OrderLine->GPPercent - filter_number_format($_POST['GPPercent_' . $OrderLine->LineNumber]))>=0.01) { /* A GP % has been input so need to do a recalculation of the price at this new GP Percentage */ Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-27 07:03:27 UTC (rev 7573) +++ trunk/doc/Change.log 2016-07-27 07:19:16 UTC (rev 7574) @@ -1,5 +1,6 @@ webERP Change Log +27/07/16 Exson: Fixed the divided by zero error when discount is 100% in SelectOrderItems.php. 27/07/16 Exson: Add error proof to avoid a blank credit note issued without any items credited or freight charge input in Credit_Invoice.php. 25/07/16 Exson: Add InternalStockRequestInquiry.php script. 22/07/16 Exson: Make items search limited to the sales orders and if search result is 1 show the result immediately in SelectSalesOrder.php |
From: <ex...@us...> - 2016-07-27 07:03:30
|
Revision: 7573 http://sourceforge.net/p/web-erp/reponame/7573 Author: exsonqu Date: 2016-07-27 07:03:27 +0000 (Wed, 27 Jul 2016) Log Message: ----------- 27/07/16 Exson: Add error proof to avoid a blank credit note issued without any items credited or freight charge input in Credit_Invoice.php. Modified Paths: -------------- trunk/Credit_Invoice.php trunk/doc/Change.log Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2016-07-25 08:13:03 UTC (rev 7572) +++ trunk/Credit_Invoice.php 2016-07-27 07:03:27 UTC (rev 7573) @@ -219,14 +219,24 @@ $myrow = DB_fetch_array($NewDispatchTaxProvResult); $_SESSION['CreditItems' . $identifier]->DispatchTaxProvince = $myrow['taxprovinceid']; + + $TotalQtyCredited = 0; foreach($_SESSION['CreditItems' . $identifier]->LineItems as $LineItem) { $_SESSION['CreditItems' . $identifier]->GetTaxes($LineItem->LineNumber); + $TotalQtyCredited += $LineItem->QtyDispatched; } } if(isset($_POST['ChargeFreightCost'])) { $_SESSION['CreditItems' . $identifier]->FreightCost = filter_number_format($_POST['ChargeFreightCost']); + if (($TotalQtyCredit + abs($_POST['ChargeFreightCost']))<=0) { + prnMsg(_('There are no item quantity or freight charge input'),'error'); + if (isset($_POST['ProcessCredit'])) { + unset($_POST['ProcessCredit']); + } + } + } if($_SESSION['SalesmanLogin'] == '') { if(isset($_POST['SalesPerson'])) { Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-25 08:13:03 UTC (rev 7572) +++ trunk/doc/Change.log 2016-07-27 07:03:27 UTC (rev 7573) @@ -1,4 +1,6 @@ webERP Change Log + +27/07/16 Exson: Add error proof to avoid a blank credit note issued without any items credited or freight charge input in Credit_Invoice.php. 25/07/16 Exson: Add InternalStockRequestInquiry.php script. 22/07/16 Exson: Make items search limited to the sales orders and if search result is 1 show the result immediately in SelectSalesOrder.php 22/07/16 Exson: Add empty check for internal request to avoid empty request creating in InternalStockRequest.php. |
From: <ex...@us...> - 2016-07-25 08:13:05
|
Revision: 7572 http://sourceforge.net/p/web-erp/reponame/7572 Author: exsonqu Date: 2016-07-25 08:13:03 +0000 (Mon, 25 Jul 2016) Log Message: ----------- 25/07/16 Exson: Add InternalStockRequestInquiry.php and add initiator for internal stock request. Modified Paths: -------------- trunk/InternalStockRequest.php trunk/doc/Change.log trunk/includes/MainMenuLinksArray.php Added Paths: ----------- trunk/InternalStockRequestInquiry.php trunk/sql/mysql/upgrade4.13-4.13.1.sql Modified: trunk/InternalStockRequest.php =================================================================== --- trunk/InternalStockRequest.php 2016-07-22 05:00:47 UTC (rev 7571) +++ trunk/InternalStockRequest.php 2016-07-25 08:13:03 UTC (rev 7572) @@ -77,13 +77,15 @@ loccode, departmentid, despatchdate, - narrative) + narrative, + initiator) VALUES( '" . $RequestNo . "', '" . $_SESSION['Request']->Location . "', '" . $_SESSION['Request']->Department . "', '" . FormatDateForSQL($_SESSION['Request']->DispatchDate) . "', - '" . $_SESSION['Request']->Narrative . "')"; + '" . $_SESSION['Request']->Narrative . "', + '" . $_SESSION['UserID'] . "')"; $ErrMsg =_('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The request header record could not be inserted because'); $DbgMsg = _('The following SQL to insert the request header record was used'); $Result = DB_query($HeaderSQL,$ErrMsg,$DbgMsg,true); Added: trunk/InternalStockRequestInquiry.php =================================================================== --- trunk/InternalStockRequestInquiry.php (rev 0) +++ trunk/InternalStockRequestInquiry.php 2016-07-25 08:13:03 UTC (rev 7572) @@ -0,0 +1,554 @@ +<?php +//Token 19 is used as the authority overwritten token to ensure that all internal request can be viewed. +include('includes/session.inc'); +$Title = _('Internal Stock Request Inquiry'); +include('includes/header.inc'); + +echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $Theme . '/images/transactions.png" title="' . $Title . '" alt="" />' . ' ' . $Title . '</p>'; + +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '" method="post">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<div>'; +if (isset($_POST['ResetPart'])) { + unset($SelectedStockItem); +} +echo '<br/><div class="centre">'; +if (isset($_POST['RequestNo'])) { + $RequestNo = $_POST['RequestNo']; +} +if (isset($_POST['SearchPart'])) { + $StockItemsResult = GetSearchItems(); +} +if (isset($_POST['StockID'])) { + $StockID = trim(mb_strtoupper($_POST['StockID'])); +} +if (isset($_POST['SelectedStockItem'])) { + $StockID = $_POST['SelectedStockItem']; +} + +if (!isset($StockID) AND !isset($_POST['Search'])) {//The scripts is just opened or click a submit button + if (!isset($RequestNo) OR $RequestNo == '') { + echo '<table class="selection"> + <tr> + <td>' . _('Request Number') . ':</td> + <td><input type="text" name="OrderNumber" maxlength="8" size="9" /></td> + <td>' . _('From Stock Location') . ':</td> + <td><select name="StockLocation">'; + $sql = "SELECT locations.loccode, locationname, canview FROM locations + INNER JOIN locationusers + ON locationusers.loccode=locations.loccode + AND locationusers.userid='" . $_SESSION['UserID'] . "' + AND locationusers.canview=1 + AND locations.internalrequest=1"; + $locresult = DB_query($sql); + $LocationCounter = DB_num_rows($locresult); + $locallctr = 0;//location all counter + $locctr = 0;//location counter + $Locations = array(); + if ($LocationCounter>0) { + while ($myrow = DB_fetch_array($locresult)) { + $Locations[] = $myrow['loccode']; + if (isset($_POST['StockLocation'])){ + if ($_POST['StockLocation'] == 'All' AND $locallctr == 0) { + $locallctr = 1; + echo '<option value="All" selected="selected">' . _('All') . '</option>'; + } elseif ($myrow['loccode'] == $_POST['StockLocation']) { + echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } + } else { + if ($LocationCounter>1 AND $locctr == 0) {//we show All only when it is necessary + echo '<option value="All">' . _('All') . '</option>'; + $loctr = 1; + } + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + } + } + echo '<select></td>'; + } else {//there are possiblity that the user is the authorization person,lets figure things out + + $sql = "SELECT stockrequest.loccode,locations.locationname FROM stockrequest INNER JOIN locations ON stockrequest.loccode=locations.loccode + INNER JOIN department ON stockrequest.departmentid=department.departmentid WHERE department.authoriser='" . $_SESSION['UserID'] . "'"; + $authresult = DB_query($sql); + $LocationCounter = DB_num_rows($authresult); + if ($LocationCounter>0) { + $Authorizer = true; + + while ($myrow = DB_fetch_array($authresult)) { + $Locations[] = $myrow['loccode']; + if (isset($_POST['StockLocation'])) { + if ($_POST['StockLocation'] == 'All' AND $locallctr==0) { + echo '<option value="All" selected="selected">' . _('All') . '</option>'; + $locallctr = 1; + } elseif ($myrow['loccode'] == $_POST['StockLocation']) { + echo '<option value="' . $myrow['loccode'] . '" selected="selected">' . $myrow['locationname'] . '</option>'; + } + } else { + if ($LocationCounter>1 AND $locctr == 0) { + $locctr = 1; + echo '<option value="All">' . _('All') . '</option>'; + } + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] .'</option>'; + } + } + echo '</select></td>'; + + + } else { + prnMsg(_('You have no authority to do the internal request inquiry'),'error'); + include('includes/footer.inc'); + exit; + } + } + echo '<input type="hidden" name="Locations" value="' . serialize($Locations) . '" />';//store the locations for later using; + if (!isset($_POST['Authorized'])) { + $_POST['Authorized'] = 'All'; + } + echo '<td>' . _('Authorisation status') . '</td> + <td><select name="Authorized">'; + $Auth = array('All'=>_('All'),0=>_('Unauthorized'),1=>_('Authorized')); + foreach ($Auth as $key=>$value) { + if ($_POST['Authorized'] == $value) { + echo '<option selected="selected" value="' . $key . '">' . $value . '</option>'; + } else { + echo '<option value="' . $key . '">' . $value . '</option>'; + } + } + echo '</select></td></tr>'; + } + //add the department, sometime we need to check each departments' internal request + if (!isset($_POST['Department'])) { + $_POST['Department'] = ''; + } + + echo '<td>' . _('Department') . '</td> + <td><select name="Department">'; + //now lets retrieve those deparment available for this user; + $sql = "SELECT departments.departmentid, + departments.description + FROM departments LEFT JOIN stockrequest + ON departments.departmentid = stockrequest.departmentid + AND (departments.authoriser = '" . $_SESSION['UserID'] . "' OR stockrequest.initiator = '" . $_SESSION['UserID'] . "') + WHERE stockrequest.dispatchid IS NOT NULL + GROUP BY stockrequest.departmentid";//if a full request is need, the users must have all of those departments' authority + $depresult = DB_query($sql); + if (DB_num_rows($depresult)>0) { + $Departments = array(); + if (isset($_POST['Department']) AND $_POST['Department'] == 'All') { + echo '<option selected="selected" value="All">' . _('All') . '</option>'; + } else { + echo '<option value="All">' . _('All') . '</option>'; + } + while ($myrow = DB_fetch_array($depresult)) { + $Departments[] = $myrow['departmentid']; + if (isset($_POST['Department']) AND ($_POST['Department'] == $myrow['departmentid'])) { + echo '<option selected="selected" value="' . $myrow['departmentid'] . '">' . $myrow['description'] . '</option>'; + } else { + echo '<option value="' . $myrow['departmentid'] . '">' . $myrow['description'] . '</option>'; + } + } + echo '</select></td>'; + echo '<input type="hidden" name="Departments" value="' . base64_encode(serialize($Departments)) . '" />'; + } else { + prnMsg(_('There are no internal request result available for your or your department'),'error'); + include('includes/footer.inc'); + exit; + } + + //now lets add the time period option + if (!isset($_POST['ToDate'])) { + $_POST['ToDate'] = ''; + } + if (!isset($_POST['FromDate'])) { + $_POST['FromDate'] = ''; + } + echo '<td>' . _('Date From') . '</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" vaue="' . $_POST['FromDate'] .'" /></td> + <td>' . _('Date To') . '</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> + <td><input type="submit" name="Search" value="' ._('Search') . '" /></td></tr></table> + + '; + if (!isset($_POST['ShowDetails'])) { + $_POST['ShowDetails'] = 1; + } + $Checked = ($_POST['ShowDetails'] == 1)?'checked="checked"':''; + echo '<td>' . _('Show Details') . ' + <input type="checkbox" ' . $Checked . ' name="ShowDetails" /> </td>'; + //following is the item search parts which belong to the existed internal request, we should not search it generally, it'll be rediculous + //hereby if the authorizer is login, we only show all category available, even if there is problem, it'll be correceted later when items selected -:) + if (isset($Authorizer)) { + $WhereAuthorizer = ''; + } else { + $WhereAuthorizer = " AND internalstockcatrole.secroleid = '" . $_SESSION['AccessLevel'] . "' "; + } + + $SQL = "SELECT stockcategory.categoryid, + stockcategory.categorydescription + FROM stockcategory, internalstockcatrole + WHERE stockcategory.categoryid = internalstockcatrole.categoryid + " . $WhereAuthorizer . " + ORDER BY stockcategory.categorydescription"; + $result1 = DB_query($SQL); + //first lets check that the category id is not zero + $Cats = DB_num_rows($result1); + + + if ($Cats >0) { + + echo '<br /><table class="selection"> + <tr> + <th colspan="6"><h3>' . _('To search for internal request for a specific part use the part selection facilities below') . '</h3></th> + </tr> + <tr> + <td>' . _('Stock Category') . '</td> + <td><select name="StockCat">'; + + if (!isset($_POST['StockCat'])) { + $_POST['StockCat'] = ''; + } + if ($_POST['StockCat'] == 'All') { + echo '<option selected="selected" value="All">' . _('All Authorized') . '</option>'; + } else { + echo '<option value="All">' . _('All Authorized') . '</option>'; + } + while ($myrow1 = DB_fetch_array($result1)) { + if ($myrow1['categoryid'] == $_POST['StockCat']) { + echo '<option selected="selected" value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; + } else { + echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; + } + } + echo '</selected></td> + <td>' . _('Enter partial') . ' <b>' . _('Description') . '</b>:</td>'; + if (!isset($_POST['Keywords'])) { + $_POST['Keywords'] = ''; + } + echo '<td><input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" /></td>'; + echo '</tr> + <tr> + <td></td> + <td></td> + <td>' . _('OR') . ' ' . _('Enter partial') . ' <b>' . _('Stock Code') . '</b>:</td>'; + if (!isset($_POST['StockCode'])) { + $_POST['StockCode'] = ''; + } + echo '<td><input type="text" autofocus="autofocus" name="StockCode" value="' . $_POST['StockCode'] . '" size="15" maxlength="18" /></td>'; + + } + echo '</tr> + </table> + <br/> + <div class="centre"> + <input type="submit" name="SearchPart" value="' . _('Search Now') . '" /> + <input type="submit" name="ResetPart" value="' . _('Show All') . '" /> + </div> + <br /> + </div> + </form>'; + + if ($Cats == 0) { + + echo '<p class="bad">' . _('Problem Report') . ':<br />' . _('There are no stock categories currently defined please use the link below to set them up') . '</p>'; + echo '<br /> + <a href="' . $RootPath . '/StockCategories.php">' . _('Define Stock Categories') . '</a>'; + exit; + } + + +} + +if(isset($StockItemsResult)){ + + if (isset($StockItemsResult) + AND DB_num_rows($StockItemsResult)>1) { + echo '<a href="' . $RootPath . '/InternalStockRequestInquiry.php">' . _('Return') . '</a>'; + echo '<table cellpadding="2" class="selection">'; + echo '<tr> + <th class="ascending" >' . _('Code') . '</th> + <th class="ascending" >' . _('Description') . '</th> + <th class="ascending" >' . _('Total Applied') . '</th> + <th>' . _('Units') . '</th> + </tr>'; + + $k=0; //row colour counter + + while ($myrow=DB_fetch_array($StockItemsResult)) { + + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + + printf('<td><input type="submit" name="SelectedStockItem" value="%s" /></td> + <td>%s</td> + <td class="number">%s</td> + <td>%s</td> + </tr>', + $myrow['stockid'], + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + $myrow['units']); +//end of page full new headings if + } +//end of while loop + + echo '</table>'; + +} + +} elseif(isset($_POST['Search']) OR isset($StockID)) {//lets show the search result here + if (isset($StockItemsResult) AND DB_num_rows($StockItemsResult) == 1) { + $StockID = DB_fetch_array($StockItemsResult); + $StockID = $StockID[0]; + } + + if (isset($_POST['ShowDetails']) OR isset($StockID)) { + $SQL = "SELECT stockrequest.dispatchid, + stockrequest.loccode, + stockrequest.departmentid, + departments.description, + locations.locationname, + despatchdate, + authorised, + closed, + narrative, + initiator, + stockrequestitems.stockid, + stockmaster.description as stkdescription, + quantity, + stockrequestitems.decimalplaces, + uom, + completed + FROM stockrequest INNER JOIN stockrequestitems ON stockrequest.dispatchid=stockrequestitems.dispatchid + INNER JOIN departments ON stockrequest.departmentid=departments.departmentid + INNER JOIN locations ON locations.loccode=stockrequest.loccode + INNER JOIN stockmaster ON stockrequestitems.stockid=stockmaster.stockid + "; + } else { + $SQL = "SELECT stockrequest.dispatchid, + stockrequest.loccode, + stockrequest.departmentid, + departments.description, + locations.locationname, + despatchdate, + authorised, + closed, + narrative, + initiator + FROM stockrequest INNER JOIN departments ON stockrequest.departmentid=departments.departmentid + INNER JOIN locations ON locations.loccode=stockrequest.loccode "; + } + //lets add the condition selected by users + if (isset($_POST['RequestNo'])) { + $SQL .= "WHERE stockrequest.dispatchid = '" . $_POST['RequsetNo'] . "'"; + } else { + //first the constraint of locations; + if ($_POST['StockLocation'] != 'All') {//retrieve the location data from current code + $SQL .= "WHERE stockrequest.loccode='" . $_POST['StockLocation'] . "'"; + } else {//retrieve the location data from serialzed data + if (!in_array(19,$_SESSION['AllowedPageSecurityTokens'])) { + $Locations = unserialize($_POST['Locations']); + $Locations = implode("','",$Locations); + $SQL .= "WHERE stockrequest.loccode in ('" . $Locations . "')"; + } + } + //the authorization status + if ($_POST['Authorized'] != 'All') {//no bothering for all + $SQL .= " AND authorised = '" . $_POST['Authorized'] . "'"; + } + //the department: if the department is all, no bothering for this since user has no relation ship with department; but consider the efficency, we should use the departments to filter those no needed out + if ($_POST['Department'] == 'All') { + if (!in_array(19,$_SESSION['AllowedPageSecurityTokens'])) { + + if (isset($_POST['Departments'])) { + $Departments = unserialize(base64_decode($_POST['Departments'])); + $Departments = implode("','", $Departments); + $SQL .= " AND stockrequest.departmentid IN ('" . $Departments . "')"; + + } //IF there are no departments set,so forgot it + + } + } else { + $SQL .= " AND stockrequest.departmentid='" . $_POST['Department'] . "'"; + } + //Date from + if (isset($_POST['DateFrom']) AND is_date($_POST['DateFrom'])) { + $SQL .= " AND despatchdate>='" . $_POST['DateFrom'] . "'"; + } + if (isset($_POST['DateTo']) AND is_date($_POST['DateTo'])) { + $SQL .= " AND despatchdate<='" . $_POST['DateTo'] . "'"; + } + //item selected + if (isset($StockID)) { + $SQL .= " AND stockrequestitems.stockid='" . $StockID . "'"; + } + }//end of no request no selected + //the user or authority contraint + if (!in_array(19,$_SESSION['AllowedPageSecurityTokens'])) { + $SQL .= " AND (authoriser='" . $_SESSION['UserID'] . "' OR initiator='" . $_SESSION['UserID'] . "')"; + } + $result = DB_query($SQL); + if (DB_num_rows($result)>0) { + $Html = ''; + if (isset($_POST['ShowDetails']) OR isset($StockID)) { + $Html .= '<table> + <tr> + <th>' . _('ID') . '</th> + <th>' . _('Locations') . '</th> + <th>' . _('Department') . '</th> + <th>' . _('Authorization') . '</th> + <th>' . _('Dispatch Date') . '</th> + <th>' . _('Stock ID') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Units') . '</th> + <th>' . _('Completed') . '</th> + </tr>'; + } else { + $Html .= '<table> + <tr> + <th>' . _('ID') . '</th> + <th>' . _('Locations') . '</th> + <th>' . _('Department') . '</th> + <th>' . _('Authorization') . '</th> + <th>' . _('Dispatch Date') . '</th> + </tr>'; + } + + if (isset($_POST['ShowDetails']) OR isset($StockID)) { + $ID = '';//mark the ID change of the internal request + } + $i = 0; + //There are items without details AND with it + while ($myrow = DB_fetch_array($result)) { + if ($i == 0) { + $Html .= "<tr class=\"EvenTableRows\">"; + $i = 1; + } elseif ($i == 1) { + $Html .= "<tr class=\"OddTableRows\">"; + $i = 0; + } + if ($myrow['authorised'] == 0) { + $Auth = _('No'); + } else { + $Auth = _('Yes'); + } + if ($myrow['despatchdate'] == '0000-00-00') { + $Disp = _('Not yet'); + } else { + $Disp = ConvertSQLDate($myrow['despatchdate']); + } + if (isset($ID)) { + if ($myrow['completed'] == 0) { + $Comp = _('No'); + } else { + $Comp = _('Yes'); + } + } + if (isset($ID) AND ($ID != $myrow['dispatchid'])) { + $ID = $myrow['dispatchid']; + $Html .= '<td>' . $myrow['dispatchid'] . '</td> + <td>' . $myrow['locationname'] . '</td> + <td>' . $myrow['description'] . '</td> + <td>' . $Auth . '</td> + <td>' . $Disp . '</td> + <td>' . $myrow['stockid'] . '</td> + <td>' . $myrow['stkdescription'] . '</td> + <td>' . locale_number_format($myrow['quantity'],$myrow['decimalplaces']) . '</td> + <td>' . $myrow['uom'] . '</td> + <td>' . $Comp . '</td>'; + + } elseif (isset($ID) AND ($ID == $myrow['dispatchid'])) { + $Html .= '<td></td> + <td></td> + <td></td> + <td></td> + <td></td> + <td>' . $myrow['stockid'] . '</td> + <td>' . $myrow['stkdescription'] . '</td> + <td>' . locale_number_format($myrow['quantity'],$myrow['decimalplaces']) . '</td> + <td>' . $myrow['uom'] . '</td> + <td>' . $Comp . '</td>'; + } elseif(!isset($ID)) { + $Html .= '<td>' . $myrow['dispatchid'] . '</td> + <td>' . $myrow['locationname'] . '</td> + <td>' . $myrow['description'] . '</td> + <td>' . $Auth . '</td> + <td>' . $Disp . '</td>'; + } + $Html .= '</tr>'; + }//end of while loop; + $Html .= '</table>'; + echo '<a href="' . $RootPath . '/InternalStockRequestInquiry.php">' . _('Select Others') . '</a>'; + + echo $Html; + } else { + prnMsg(_('There are no stock request available'),'warn'); + } + + + + + + + + + + +} + +include('includes/footer.inc'); +exit; + +function GetSearchItems ($SQLConstraint='') { + global $db; + if ($_POST['Keywords'] AND $_POST['StockCode']) { + echo _('Stock description keywords have been used in preference to the Stock code extract entered'); + } + $SQL = "SELECT stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + SUM(stockrequestitems.quantity) AS qoh, + stockmaster.units + FROM stockrequestitems INNER JOIN stockrequest ON stockrequestitems.dispatchid=stockrequest.dispatchid + INNER JOIN departments ON stockrequest.departmentid = departments.departmentid + + INNER JOIN stockmaster ON stockrequestitems.stockid = stockmaster.stockid"; + if (isset($_POST['StockCat']) + AND ((trim($_POST['StockCat']) == '') OR $_POST['StockCat'] == 'All')){ + $WhereStockCat = ''; + } else { + $WhereStockCat = " AND stockmaster.categoryid='" . $_POST['StockCat'] . "' "; + } + if ($_POST['Keywords']) { + //insert wildcard characters in spaces + $SearchString = '%' . str_replace(' ', '%', $_POST['Keywords']) . '%'; + + $SQL .= " WHERE stockmaster.description " . LIKE . " '" . $SearchString . "' + " . $WhereStockCat ; + + + } elseif (isset($_POST['StockCode'])){ + $SQL .= " WHERE stockmaster.stockid " . LIKE . " '%" . $_POST['StockCode'] . "%'" . $WhereStockCat; + + } elseif (!isset($_POST['StockCode']) AND !isset($_POST['Keywords'])) { + $SQL .= " WHERE stockmaster.categoryid='" . $_POST['StockCat'] ."'"; + + } + $SQL .= ' AND (departments.authoriser="' . $_SESSION['UserID'] . '" OR initiator="' . $_SESSION['UserID'] . '") '; + $SQL .= $SQLConstraint; + $SQL .= " GROUP BY stockmaster.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units + ORDER BY stockmaster.stockid"; + $ErrMsg = _('No stock items were returned by the SQL because'); + $DbgMsg = _('The SQL used to retrieve the searched parts was'); + $StockItemsResult = DB_query($SQL,$ErrMsg,$DbgMsg); + return $StockItemsResult; + + } +?> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-22 05:00:47 UTC (rev 7571) +++ trunk/doc/Change.log 2016-07-25 08:13:03 UTC (rev 7572) @@ -1,5 +1,5 @@ webERP Change Log - +25/07/16 Exson: Add InternalStockRequestInquiry.php script. 22/07/16 Exson: Make items search limited to the sales orders and if search result is 1 show the result immediately in SelectSalesOrder.php 22/07/16 Exson: Add empty check for internal request to avoid empty request creating in InternalStockRequest.php. 09/07/16 Exson: Fixed the utf8 character print incorrect of pdf file in class.pdf.php. Modified: trunk/includes/MainMenuLinksArray.php =================================================================== --- trunk/includes/MainMenuLinksArray.php 2016-07-22 05:00:47 UTC (rev 7571) +++ trunk/includes/MainMenuLinksArray.php 2016-07-25 08:13:03 UTC (rev 7572) @@ -244,7 +244,8 @@ _('List Negative Stocks'), _('Period Stock Transaction Listing'), _('Stock Transfer Note'), - _('Aged Controlled Stock Report')); + _('Aged Controlled Stock Report'), + _('Internal stock request inquiry')); $MenuItems['stock']['Reports']['URL'] = array( '/StockSerialItemResearch.php', '/PDFPrintLabel.php', @@ -268,7 +269,8 @@ '/PDFStockNegatives.php', '/PDFPeriodStockTransListing.php', '/PDFStockTransfer.php', - '/AgedControlledInventory.php'); + '/AgedControlledInventory.php', + '/InternalStockRequestInquiry.php'); $MenuItems['stock']['Maintenance']['Caption'] = array( _('Add A New Item'), _('Select An Item'), Added: trunk/sql/mysql/upgrade4.13-4.13.1.sql =================================================================== --- trunk/sql/mysql/upgrade4.13-4.13.1.sql (rev 0) +++ trunk/sql/mysql/upgrade4.13-4.13.1.sql 2016-07-25 08:13:03 UTC (rev 7572) @@ -0,0 +1,5 @@ +INSERT INTO scripts VALUES ('InternalStockRequestInquiry.php',1,'Internal Stock Request inquiry'); +ALTER table stockrequest ADD initiator varchar(20) NOT NULL DEFAULT ''; +INSERT INTO securitytokens VALUES (19,'Internal stock request fully access authority'); + + |
From: <ex...@us...> - 2016-07-22 05:00:50
|
Revision: 7571 http://sourceforge.net/p/web-erp/reponame/7571 Author: exsonqu Date: 2016-07-22 05:00:47 +0000 (Fri, 22 Jul 2016) Log Message: ----------- 22/07/16 Exson: Make items search limited to the sales orders and if search result is 1 show the result immediately in SelectSalesOrder.php Modified Paths: -------------- trunk/SelectSalesOrder.php trunk/doc/Change.log Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2016-07-22 00:46:50 UTC (rev 7570) +++ trunk/SelectSalesOrder.php 2016-07-22 05:00:47 UTC (rev 7571) @@ -530,6 +530,7 @@ <tr> <td>' . _('Select a stock category') . ': <select name="StockCat">'; + echo '<option value="All">' . _('All') . '</option>'; while ($myrow1 = DB_fetch_array($result1)) { echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; @@ -552,7 +553,7 @@ <br />'; if (isset($StockItemsResult) - AND DB_num_rows($StockItemsResult)>0) { + AND DB_num_rows($StockItemsResult)>1) { echo '<table cellpadding="2" class="selection">'; echo '<tr> @@ -592,6 +593,10 @@ } //end if stock search results to show else { + if (isset($StockItemsResult) AND DB_num_rows($StockItemsResult) == 1) { + $mystkrow = DB_fetch_array($StockItemsResult); + $SelectedStockItem = $mystkrow['stockid']; + } //figure out the SQL required from the inputs available if (isset($_POST['Quotations']) AND $_POST['Quotations']=='Orders_Only'){ @@ -880,9 +885,12 @@ stockmaster.decimalplaces, SUM(locstock.quantity) AS qoh, stockmaster.units - FROM stockmaster INNER JOIN locstock + FROM salesorderdetails INNER JOIN stockmaster + ON salesorderdetails.stkcode = stockmaster.stockid AND completed=0 + INNER JOIN locstock ON stockmaster.stockid=locstock.stockid"; - if (isset($_POST['StockCat']) AND trim($_POST['StockCat'])==''){ + if (isset($_POST['StockCat']) + AND ((trim($_POST['StockCat']) == '') OR $_POST['StockCat'] == 'All')){ $WhereStockCat = ''; } else { $WhereStockCat = " AND stockmaster.categoryid='" . $_POST['StockCat'] . "' "; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-22 00:46:50 UTC (rev 7570) +++ trunk/doc/Change.log 2016-07-22 05:00:47 UTC (rev 7571) @@ -1,4 +1,6 @@ webERP Change Log + +22/07/16 Exson: Make items search limited to the sales orders and if search result is 1 show the result immediately in SelectSalesOrder.php 22/07/16 Exson: Add empty check for internal request to avoid empty request creating in InternalStockRequest.php. 09/07/16 Exson: Fixed the utf8 character print incorrect of pdf file in class.pdf.php. 08/07/16 Exson: Fixed the transaction atomicity bug by change table lock to row lock in SQL_CommonFunctions.inc. |
From: <ex...@us...> - 2016-07-22 00:46:53
|
Revision: 7570 http://sourceforge.net/p/web-erp/reponame/7570 Author: exsonqu Date: 2016-07-22 00:46:50 +0000 (Fri, 22 Jul 2016) Log Message: ----------- 22/07/16 Exson: Add empty check for internal request to avoid empty request creating in InternalStockRequest.php. Modified Paths: -------------- trunk/InternalStockRequest.php trunk/doc/Change.log Modified: trunk/InternalStockRequest.php =================================================================== --- trunk/InternalStockRequest.php 2016-07-09 03:17:59 UTC (rev 7569) +++ trunk/InternalStockRequest.php 2016-07-22 00:46:50 UTC (rev 7570) @@ -59,7 +59,8 @@ } } -if (isset($_POST['Submit'])) { +if (isset($_POST['Submit']) AND (!empty($_SESSION['Request']->LineItems))) { + DB_Txn_Begin(); $InputError=0; if ($_SESSION['Request']->Department=='') { @@ -133,6 +134,8 @@ include('includes/footer.inc'); unset($_SESSION['Request']); exit; +} elseif(isset($_POST['Submit'])) { + prnMsg(_('There are no items added to this request'),'error'); } echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/supplier.png" title="' . _('Dispatch') . @@ -275,24 +278,24 @@ </tr>'; $k=0; - -foreach ($_SESSION['Request']->LineItems as $LineItems) { - - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k++; +if (isset($_SESSION['Request']->LineItems)) { + foreach ($_SESSION['Request']->LineItems as $LineItems) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k++; + } + echo '<td>' . $LineItems->LineNumber . '</td> + <td>' . $LineItems->StockID . '</td> + <td>' . $LineItems->ItemDescription . '</td> + <td class="number">' . locale_number_format($LineItems->Quantity, $LineItems->DecimalPlaces) . '</td> + <td>' . $LineItems->UOM . '</td> + <td><a href="'. htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?Edit='.$LineItems->LineNumber.'">' . _('Edit') . '</a></td> + <td><a href="'. htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?Delete='.$LineItems->LineNumber.'">' . _('Delete') . '</a></td> + </tr>'; } - echo '<td>' . $LineItems->LineNumber . '</td> - <td>' . $LineItems->StockID . '</td> - <td>' . $LineItems->ItemDescription . '</td> - <td class="number">' . locale_number_format($LineItems->Quantity, $LineItems->DecimalPlaces) . '</td> - <td>' . $LineItems->UOM . '</td> - <td><a href="'. htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?Edit='.$LineItems->LineNumber.'">' . _('Edit') . '</a></td> - <td><a href="'. htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?Delete='.$LineItems->LineNumber.'">' . _('Delete') . '</a></td> - </tr>'; } echo '</table> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-09 03:17:59 UTC (rev 7569) +++ trunk/doc/Change.log 2016-07-22 00:46:50 UTC (rev 7570) @@ -1,4 +1,5 @@ webERP Change Log +22/07/16 Exson: Add empty check for internal request to avoid empty request creating in InternalStockRequest.php. 09/07/16 Exson: Fixed the utf8 character print incorrect of pdf file in class.pdf.php. 08/07/16 Exson: Fixed the transaction atomicity bug by change table lock to row lock in SQL_CommonFunctions.inc. 08/07/16 Exson: Fixed the bug that when bank account or currency changes the functional rate or exrate unchanged with suggested rate in Payments.php. |
From: <ex...@us...> - 2016-07-09 03:18:02
|
Revision: 7569 http://sourceforge.net/p/web-erp/reponame/7569 Author: exsonqu Date: 2016-07-09 03:17:59 +0000 (Sat, 09 Jul 2016) Log Message: ----------- 09/07/16 Exson: Fixed the utf8 character print incorrect of pdf file in class.pdf.php. Modified Paths: -------------- trunk/doc/Change.log trunk/includes/class.pdf.php Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-08 10:08:45 UTC (rev 7568) +++ trunk/doc/Change.log 2016-07-09 03:17:59 UTC (rev 7569) @@ -1,5 +1,5 @@ webERP Change Log - +09/07/16 Exson: Fixed the utf8 character print incorrect of pdf file in class.pdf.php. 08/07/16 Exson: Fixed the transaction atomicity bug by change table lock to row lock in SQL_CommonFunctions.inc. 08/07/16 Exson: Fixed the bug that when bank account or currency changes the functional rate or exrate unchanged with suggested rate in Payments.php. 07/07/16: Exson: Fixed the bug of wrong original amount of payments to another bank accounts in GLAccountInquiry.php and wrong transaction link in DailyBankTransactions.php and add payment transaction no in bank transaction ref to make it traceable. Modified: trunk/includes/class.pdf.php =================================================================== --- trunk/includes/class.pdf.php 2016-07-08 10:08:45 UTC (rev 7568) +++ trunk/includes/class.pdf.php 2016-07-09 03:17:59 UTC (rev 7569) @@ -109,7 +109,7 @@ case 'full': $Align = 'J'; break; default: - $Align = 'L'; break; + $Align = 'L'; } $this->SetFontSize($Height);// Public function SetFontSize() in ~/includes/tcpdf/tcpdf.php. @@ -177,9 +177,9 @@ } } - $this->Cell($Width, $Height, mb_substr($s,0,$sep), $b, 2, $Align, $fill); + $this->Cell($Width,$Height,mb_substr($s,0,$sep,'UTF-8'),$b,2,$Align,$fill); $this->x=$this->lMargin; - return mb_substr($s, $sep); + return mb_substr($s, $sep,null,'UTF-8'); }// End function addTextWrap. function addInfo($label, $value) { |
From: <ex...@us...> - 2016-07-08 10:08:48
|
Revision: 7568 http://sourceforge.net/p/web-erp/reponame/7568 Author: exsonqu Date: 2016-07-08 10:08:45 +0000 (Fri, 08 Jul 2016) Log Message: ----------- 08/07/16 Exson: Fixed the transaction atomicity failure bug by change table lock to row lock in SQL_CommonFunctions.inc. Modified Paths: -------------- trunk/doc/Change.log trunk/includes/SQL_CommonFunctions.inc Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-08 08:17:10 UTC (rev 7567) +++ trunk/doc/Change.log 2016-07-08 10:08:45 UTC (rev 7568) @@ -1,5 +1,6 @@ webERP Change Log +08/07/16 Exson: Fixed the transaction atomicity bug by change table lock to row lock in SQL_CommonFunctions.inc. 08/07/16 Exson: Fixed the bug that when bank account or currency changes the functional rate or exrate unchanged with suggested rate in Payments.php. 07/07/16: Exson: Fixed the bug of wrong original amount of payments to another bank accounts in GLAccountInquiry.php and wrong transaction link in DailyBankTransactions.php and add payment transaction no in bank transaction ref to make it traceable. 29/06/16 Exson: add identifier to avoid SESSION overwritten in CustomerReceipt.php. Modified: trunk/includes/SQL_CommonFunctions.inc =================================================================== --- trunk/includes/SQL_CommonFunctions.inc 2016-07-08 08:17:10 UTC (rev 7567) +++ trunk/includes/SQL_CommonFunctions.inc 2016-07-08 10:08:45 UTC (rev 7568) @@ -16,25 +16,18 @@ etc * */ - - DB_query("LOCK TABLES systypes WRITE"); - - $SQL = "SELECT typeno FROM systypes WHERE typeid = '" . $TransType . "'"; - + DB_query("SELECT typeno FROM systypes WHERE typeid='" . $TransType ."' FOR UPDATE"); + $SQL = "UPDATE systypes SET typeno = typeno + 1 WHERE typeid = '" . $TransType . "'"; + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The transaction number could not be incremented'); + $DbgMsg = _('The following SQL to increment the transaction number was used'); + $UpdTransNoResult = DB_query($SQL,$ErrMsg,$DbgMsg); + $SQL = "SELECT typeno FROM systypes WHERE typeid= '" . $TransType . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': <BR>' . _('The next transaction number could not be retrieved from the database because'); $DbgMsg = _('The following SQL to retrieve the transaction number was used'); $GetTransNoResult = DB_query($SQL,$ErrMsg,$DbgMsg); - $myrow = DB_fetch_row($GetTransNoResult); - - $SQL = "UPDATE systypes SET typeno = '" . ($myrow[0] + 1) . "' WHERE typeid = '" . $TransType . "'"; - $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The transaction number could not be incremented'); - $DbgMsg = _('The following SQL to increment the transaction number was used'); - $UpdTransNoResult = DB_query($SQL,$ErrMsg,$DbgMsg); - - DB_query("UNLOCK TABLES"); - - return $myrow[0] + 1; + return $myrow[0]; + } @@ -512,4 +505,4 @@ } //$myrow[0]>0 } -?> \ No newline at end of file +?> |
From: <ex...@us...> - 2016-07-08 08:17:13
|
Revision: 7567 http://sourceforge.net/p/web-erp/reponame/7567 Author: exsonqu Date: 2016-07-08 08:17:10 +0000 (Fri, 08 Jul 2016) Log Message: ----------- 08/07/16 Exson: Fixed the bug that when bank account or currency changes the functional rate or exrate unchanged with suggested rate in Payments.php. Modified Paths: -------------- trunk/Payments.php trunk/doc/Change.log Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2016-07-07 11:12:58 UTC (rev 7566) +++ trunk/Payments.php 2016-07-08 08:17:10 UTC (rev 7567) @@ -899,10 +899,8 @@ $_POST['FunctionalExRate']=1; } if($_SESSION['PaymentDetail'.$identifier]->AccountCurrency != $_SESSION['PaymentDetail'.$identifier]->Currency AND isset($_SESSION['PaymentDetail'.$identifier]->AccountCurrency)) { - if($_POST['ExRate']==1 AND isset($SuggestedExRate)) { + if (isset($SuggestedExRate) AND ($_POST['ExRate'] == 1 OR $_POST['Currency'] != $_POST['PreviousCurrency'] OR $_POST['PreviousBankAccount'] != $_SESSION['PaymentDetail' . $identifier]->Account)) { $_POST['ExRate'] = locale_number_format($SuggestedExRate,8); - } elseif($_POST['Currency'] != $_POST['PreviousCurrency'] AND isset($SuggestedExRate)) { - $_POST['ExRate'] = locale_number_format($SuggestedExRate,8); } if(isset($SuggestedExRate)) { @@ -917,9 +915,9 @@ } if($_SESSION['PaymentDetail'.$identifier]->AccountCurrency != $_SESSION['CompanyRecord']['currencydefault'] AND isset($_SESSION['PaymentDetail'.$identifier]->AccountCurrency)) { - if($_POST['FunctionalExRate']==1 AND isset($SuggestedFunctionalExRate)) { + if (isset($SuggestedFunctionalExRate) AND ($_POST['FunctionalExRate']==1 OR $_POST['Currency'] != $_POST['PreviousCurrency'] OR $_POST['PreviousBankAccount'] != $_SESSION['PaymentDetail' . $identifier]->Account)) { $_POST['FunctionalExRate'] = locale_number_format($SuggestedFunctionalExRate,'Variable'); - } + } if(isset($SuggestedFunctionalExRate)) { $SuggestedFunctionalExRateText = '<b>' . _('Suggested rate:') . ' 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ' . locale_number_format($SuggestedFunctionalExRate,8) . ' ' . $_SESSION['PaymentDetail'.$identifier]->AccountCurrency . '</b>'; @@ -979,6 +977,7 @@ echo '<tr> <td colspan="2"><div class="centre"> <input name="PreviousCurrency" type="hidden" value="', $_POST['Currency'], '" /> + <input type="hidden" name="PreviousBankAccount" value="' . $_SESSION['PaymentDetail' . $identifier]->Account . '" /> <input name="UpdateHeader" type="submit" value="', _('Update'), '" /> </div></td> </tr> Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-07 11:12:58 UTC (rev 7566) +++ trunk/doc/Change.log 2016-07-08 08:17:10 UTC (rev 7567) @@ -1,5 +1,6 @@ webERP Change Log +08/07/16 Exson: Fixed the bug that when bank account or currency changes the functional rate or exrate unchanged with suggested rate in Payments.php. 07/07/16: Exson: Fixed the bug of wrong original amount of payments to another bank accounts in GLAccountInquiry.php and wrong transaction link in DailyBankTransactions.php and add payment transaction no in bank transaction ref to make it traceable. 29/06/16 Exson: add identifier to avoid SESSION overwritten in CustomerReceipt.php. 29/06/16 Exson: Fixed the wrong balance of amount in bank account currency in DailyBankTransactions.php. |
From: <ex...@us...> - 2016-07-07 11:13:01
|
Revision: 7566 http://sourceforge.net/p/web-erp/reponame/7566 Author: exsonqu Date: 2016-07-07 11:12:58 +0000 (Thu, 07 Jul 2016) Log Message: ----------- Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-07-07 11:11:34 UTC (rev 7565) +++ trunk/doc/Change.log 2016-07-07 11:12:58 UTC (rev 7566) @@ -1,5 +1,6 @@ webERP Change Log +07/07/16: Exson: Fixed the bug of wrong original amount of payments to another bank accounts in GLAccountInquiry.php and wrong transaction link in DailyBankTransactions.php and add payment transaction no in bank transaction ref to make it traceable. 29/06/16 Exson: add identifier to avoid SESSION overwritten in CustomerReceipt.php. 29/06/16 Exson: Fixed the wrong balance of amount in bank account currency in DailyBankTransactions.php. 20/06/16 Exson: Fixed bom clone failure due to fields missing in CopyBom.php. Reported by shane. |
From: <ex...@us...> - 2016-07-07 11:11:37
|
Revision: 7565 http://sourceforge.net/p/web-erp/reponame/7565 Author: exsonqu Date: 2016-07-07 11:11:34 +0000 (Thu, 07 Jul 2016) Log Message: ----------- 07/07/16: Exson: Fixed the bug of wrong original amount of payments to another bank accounts in GLAccountInquiry.php and wrong transaction link in DailyBankTransactions.php and add payment transaction no in bank transaction ref to make it traceable. Modified Paths: -------------- trunk/DailyBankTransactions.php trunk/GLAccountInquiry.php trunk/Payments.php Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2016-07-03 06:58:29 UTC (rev 7564) +++ trunk/DailyBankTransactions.php 2016-07-07 11:11:34 UTC (rev 7565) @@ -194,6 +194,10 @@ $k = 0; } //check the GL narrative + if ($myrow['type'] == 2) { + $myrow['typeid'] = 1; + $myrow['transno'] = substr($myrow['ref'],1,strpos($myrow['ref'],' ')-1); + } $sql = "SELECT narrative FROM gltrans WHERE type='" . $myrow['typeid'] . "' AND typeno='" . $myrow['transno'] . "'"; $ErrMsg = _('Failed to retrieve gl narrative'); $glresult = DB_query($sql,$ErrMsg); Modified: trunk/GLAccountInquiry.php =================================================================== --- trunk/GLAccountInquiry.php 2016-07-03 06:58:29 UTC (rev 7564) +++ trunk/GLAccountInquiry.php 2016-07-07 11:11:34 UTC (rev 7565) @@ -165,7 +165,6 @@ } $sql = $sql . " ORDER BY periodno, gltrans.trandate, counterindex"; - $namesql = "SELECT accountname FROM chartmaster WHERE accountcode='" . $SelectedAccount . "'"; $nameresult = DB_query($namesql); $namerow=DB_fetch_array($nameresult); @@ -296,6 +295,29 @@ $BankRef = $bankrow['ref']; $OrgAmt = $bankrow['amount']; $Currency = $bankrow['currcode']; + } elseif ($myrow['type'] == 1) { + //We should find out when transaction happens between bank accounts; + $bankreceivesql = "SELECT ref,type,transno,currcode,amount FROM banktrans + WHERE ref LIKE '@%' AND transdate='" . $myrow['trandate'] . "' AND bankact='" . $SelectedAccount . "'"; + $ErrMsg = _('Failed to retrieve bank receive data'); + $bankresult = DB_query($bankreceivesql,$ErrMsg); + if (DB_num_rows($bankresult)>0) { + while ($bankrow = DB_fetch_array($bankresult)) { + if (substr($bankrow['ref'],1,strpos($bankrow['ref'],' ')-1) == $myrow['typeno']) { + $BankRef = $bankrow['ref']; + $OrgAmt = $bankrow['amount']; + $Currency = $bankrow['currcode']; + $BankReceipt = true; + break; + } + } + } + if (!isset($BankReceipt)) { + $BankRef = ''; + $OrgAmt = $myrow['amount']; + $Currency = $_SESSION['CompanyRecord']['currencydefault']; + } + } elseif(isset($BankAccount)){ $BankRef = ''; $OrgAmt = $myrow['amount']; Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2016-07-03 06:58:29 UTC (rev 7564) +++ trunk/Payments.php 2016-07-07 11:11:34 UTC (rev 7565) @@ -460,7 +460,7 @@ $ReceiptTransNo . "', 2,'" . $PaymentItem->GLCode . "','" . - _('Act Transfer From ') . $_SESSION['PaymentDetail'.$identifier]->Account . ' - ' . $PaymentItem->Narrative . "','" . + '@' . $TransNo . ' ' . _('Act Transfer From ') . $_SESSION['PaymentDetail'.$identifier]->Account . ' - ' . $PaymentItem->Narrative . "','" . (($_SESSION['PaymentDetail'.$identifier]->ExRate * $_SESSION['PaymentDetail'.$identifier]->FunctionalExRate)/$TrfToBankExRate). "','" . $TrfToBankExRate . "','" . FormatDateForSQL($_SESSION['PaymentDetail'.$identifier]->DatePaid) . "','" . |
From: <dai...@us...> - 2016-07-03 06:58:32
|
Revision: 7564 http://sourceforge.net/p/web-erp/reponame/7564 Author: daintree Date: 2016-07-03 06:58:29 +0000 (Sun, 03 Jul 2016) Log Message: ----------- add check that the GL accounts have not been deleted to orphan transactions Modified Paths: -------------- trunk/Z_CheckGLTransBalance.php Modified: trunk/Z_CheckGLTransBalance.php =================================================================== --- trunk/Z_CheckGLTransBalance.php 2016-06-29 06:28:42 UTC (rev 7563) +++ trunk/Z_CheckGLTransBalance.php 2016-07-03 06:58:29 UTC (rev 7564) @@ -21,9 +21,10 @@ gltrans.typeno, periodno, SUM(amount) AS nettot - FROM gltrans, - systypes - WHERE gltrans.type = systypes.typeid + FROM gltrans + INNER JOIN chartmaster ON + gltrans.account=chartmaster.accountcode + INNER JOIN systypes ON gltrans.type = systypes.typeid GROUP BY gltrans.type, systypes.typename, typeno, |
From: <ex...@us...> - 2016-06-29 06:28:46
|
Revision: 7563 http://sourceforge.net/p/web-erp/reponame/7563 Author: exsonqu Date: 2016-06-29 06:28:42 +0000 (Wed, 29 Jun 2016) Log Message: ----------- Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-06-29 06:27:55 UTC (rev 7562) +++ trunk/doc/Change.log 2016-06-29 06:28:42 UTC (rev 7563) @@ -1,4 +1,7 @@ webERP Change Log + +29/06/16 Exson: add identifier to avoid SESSION overwritten in CustomerReceipt.php. +29/06/16 Exson: Fixed the wrong balance of amount in bank account currency in DailyBankTransactions.php. 20/06/16 Exson: Fixed bom clone failure due to fields missing in CopyBom.php. Reported by shane. 20/06/16 Exson: Fixed the bug that # is not allowed as part of stockid in SelectProduct.php. 16/06/16 Exson: Make monthly payment term can be more than 30 days. |
From: <ex...@us...> - 2016-06-29 06:27:57
|
Revision: 7562 http://sourceforge.net/p/web-erp/reponame/7562 Author: exsonqu Date: 2016-06-29 06:27:55 +0000 (Wed, 29 Jun 2016) Log Message: ----------- 29/06/16 Exson: add identifier to avoid SESSION overwritten in CustomerReceipt.php. Modified Paths: -------------- trunk/CustomerReceipt.php Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2016-06-29 05:35:22 UTC (rev 7561) +++ trunk/CustomerReceipt.php 2016-06-29 06:27:55 UTC (rev 7562) @@ -17,13 +17,19 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); +if (empty($_GET['identifier'])) { + $identifier = date('U'); +} else { + $identifier = $_GET['identifier']; +} + $msg=''; if (isset($_GET['NewReceipt'])){ - unset($_SESSION['ReceiptBatch']->Items); - unset($_SESSION['ReceiptBatch']); - unset($_SESSION['CustomerRecord']); + unset($_SESSION['ReceiptBatch' . $identifier]->Items); + unset($_SESSION['ReceiptBatch' . $identifier]); + unset($_SESSION['CustomerRecord' . $identifier]); } if (isset($_POST['Cancel'])) { @@ -47,11 +53,11 @@ } else { $BankAccountEmpty=false; } - -if (!isset($_GET['Delete']) AND isset($_SESSION['ReceiptBatch'])){ +$Errors = array(); +if (!isset($_GET['Delete']) AND isset($_SESSION['ReceiptBatch' . $identifier])){ //always process a header update unless deleting an item - $_SESSION['ReceiptBatch']->Account = $_POST['BankAccount']; + $_SESSION['ReceiptBatch' . $identifier]->Account = $_POST['BankAccount']; /*Get the bank account currency and set that too */ $SQL = "SELECT bankaccountname, @@ -67,9 +73,9 @@ if (DB_num_rows($result)==1){ $myrow = DB_fetch_array($result); - $_SESSION['ReceiptBatch']->BankAccountName = $myrow['bankaccountname']; - $_SESSION['ReceiptBatch']->AccountCurrency=$myrow['currcode']; - $_SESSION['ReceiptBatch']->CurrDecimalPlaces=$myrow['decimalplaces']; + $_SESSION['ReceiptBatch' . $identifier]->BankAccountName = $myrow['bankaccountname']; + $_SESSION['ReceiptBatch' . $identifier]->AccountCurrency=$myrow['currcode']; + $_SESSION['ReceiptBatch' . $identifier]->CurrDecimalPlaces=$myrow['decimalplaces']; unset($result); } elseif (DB_num_rows($result)==0 AND !$BankAccountEmpty){ prnMsg( _('The bank account number') . ' ' . $_POST['BankAccount'] . ' ' . _('is not set up as a bank account'),'error'); @@ -80,41 +86,41 @@ if (!Is_Date($_POST['DateBanked'])){ $_POST['DateBanked'] = Date($_SESSION['DefaultDateFormat']); } - $_SESSION['ReceiptBatch']->DateBanked = $_POST['DateBanked']; + $_SESSION['ReceiptBatch' . $identifier]->DateBanked = $_POST['DateBanked']; if (isset($_POST['ExRate']) AND $_POST['ExRate']!=''){ if (is_numeric(filter_number_format($_POST['ExRate']))){ - $_SESSION['ReceiptBatch']->ExRate = filter_number_format($_POST['ExRate']); + $_SESSION['ReceiptBatch' . $identifier]->ExRate = filter_number_format($_POST['ExRate']); } else { prnMsg(_('The exchange rate entered should be numeric'),'warn'); } } if (isset($_POST['FunctionalExRate']) AND $_POST['FunctionalExRate']!=''){ if (is_numeric(filter_number_format($_POST['FunctionalExRate']))){ - $_SESSION['ReceiptBatch']->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); //ex rate between receipt currency and account currency + $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate=filter_number_format($_POST['FunctionalExRate']); //ex rate between receipt currency and account currency } else { prnMsg(_('The functional exchange rate entered should be numeric'),'warn'); } } - $_SESSION['ReceiptBatch']->ReceiptType = $_POST['ReceiptType']; + $_SESSION['ReceiptBatch' . $identifier]->ReceiptType = $_POST['ReceiptType']; if (!isset($_POST['Currency'])){ $_POST['Currency']=$_SESSION['CompanyRecord']['currencydefault']; } - if ($_SESSION['ReceiptBatch']->Currency!=$_POST['Currency']){ + if ($_SESSION['ReceiptBatch' . $identifier]->Currency!=$_POST['Currency']){ - $_SESSION['ReceiptBatch']->Currency=$_POST['Currency']; //receipt currency + $_SESSION['ReceiptBatch' . $identifier]->Currency=$_POST['Currency']; //receipt currency /*Now customer receipts entered using the previous currency need to be ditched and a warning message displayed if there were some customer receipted entered */ - if (count($_SESSION['ReceiptBatch']->Items)>0){ - unset($_SESSION['ReceiptBatch']->Items); + if (count($_SESSION['ReceiptBatch' . $identifier]->Items)>0){ + unset($_SESSION['ReceiptBatch' . $identifier]->Items); prnMsg(_('Changing the currency of the receipt means that existing entries need to be re-done - only customers trading in the selected currency can be selected'),'warn'); } } - if ($_SESSION['ReceiptBatch']->AccountCurrency==$_SESSION['CompanyRecord']['currencydefault']){ - $_SESSION['ReceiptBatch']->FunctionalExRate = 1; + if ($_SESSION['ReceiptBatch' . $identifier]->AccountCurrency==$_SESSION['CompanyRecord']['currencydefault']){ + $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate = 1; $SuggestedFunctionalExRate =1; } elseif (!$BankAccountEmpty) { /*To illustrate the rates required @@ -127,33 +133,33 @@ */ /*Get suggested FunctionalExRate between the bank account currency and the home (functional) currency */ - $result = DB_query("SELECT rate, decimalplaces FROM currencies WHERE currabrev='" . $_SESSION['ReceiptBatch']->AccountCurrency . "'"); + $result = DB_query("SELECT rate, decimalplaces FROM currencies WHERE currabrev='" . $_SESSION['ReceiptBatch' . $identifier]->AccountCurrency . "'"); $myrow = DB_fetch_array($result); $SuggestedFunctionalExRate = $myrow['rate']; - $_SESSION['ReceiptBatch']->CurrDecimalPlaces = $myrow['decimalplaces']; + $_SESSION['ReceiptBatch' . $identifier]->CurrDecimalPlaces = $myrow['decimalplaces']; } //end else account currency != functional currency - if ($_POST['Currency']==$_SESSION['ReceiptBatch']->AccountCurrency){ - $_SESSION['ReceiptBatch']->ExRate = 1; //ex rate between receipt currency and account currency + if ($_POST['Currency']==$_SESSION['ReceiptBatch' . $identifier]->AccountCurrency){ + $_SESSION['ReceiptBatch' . $identifier]->ExRate = 1; //ex rate between receipt currency and account currency $SuggestedExRate=1; } elseif(isset($_POST['Currency'])) { /*Get the exchange rate between the functional currency and the receipt currency*/ - $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['ReceiptBatch']->Currency . "'"); + $result = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['ReceiptBatch' . $identifier]->Currency . "'"); $myrow = DB_fetch_array($result); $TableExRate = $myrow['rate']; //this is the rate of exchange between the functional currency and the receipt currency /*Calculate cross rate to suggest appropriate exchange rate between receipt currency and account currency */ $SuggestedExRate = $TableExRate/$SuggestedFunctionalExRate; } - $_SESSION['ReceiptBatch']->BankTransRef = $_POST['BankTransRef']; - $_SESSION['ReceiptBatch']->Narrative = $_POST['BatchNarrative']; + $_SESSION['ReceiptBatch' . $identifier]->BankTransRef = $_POST['BankTransRef']; + $_SESSION['ReceiptBatch' . $identifier]->Narrative = $_POST['BatchNarrative']; } elseif (isset($_GET['Delete'])) { /* User hit delete the receipt entry from the batch */ - $_SESSION['ReceiptBatch']->remove_receipt_item($_GET['Delete']); + $_SESSION['ReceiptBatch' . $identifier]->remove_receipt_item($_GET['Delete']); } else { //it must be a new receipt batch - $_SESSION['ReceiptBatch'] = new Receipt_Batch; + $_SESSION['ReceiptBatch' . $identifier] = new Receipt_Batch; } @@ -193,7 +199,7 @@ } } if ($AllowThisPosting) { - $_SESSION['ReceiptBatch']->add_to_batch(filter_number_format($_POST['Amount']), + $_SESSION['ReceiptBatch' . $identifier]->add_to_batch(filter_number_format($_POST['Amount']), $_POST['CustomerID'], filter_number_format($_POST['Discount']), $_POST['Narrative'], @@ -208,7 +214,7 @@ } if (isset($Cancel)){ - unset($_SESSION['CustomerRecord']); + unset($_SESSION['CustomerRecord' . $identifier]); unset($_POST['CustomerID']); unset($_POST['CustomerName']); unset($_POST['Amount']); @@ -234,7 +240,7 @@ and add up the non-GL ones for posting to debtors later, also add the total discount total receipts*/ - $PeriodNo = GetPeriod($_SESSION['ReceiptBatch']->DateBanked,$db); + $PeriodNo = GetPeriod($_SESSION['ReceiptBatch' . $identifier]->DateBanked,$db); if ($_SESSION['CompanyRecord']==0){ prnMsg(_('The company has not yet been set up properly') . ' - ' . _('this information is needed to process the batch') . '. ' . _('Processing has been cancelled'),'error'); @@ -252,7 +258,7 @@ $i++; } - $_SESSION['ReceiptBatch']->BatchNo = GetNextTransNo(12,$db); + $_SESSION['ReceiptBatch' . $identifier]->BatchNo = GetNextTransNo(12,$db); /*Start a transaction to do the whole lot inside */ $result = DB_Txn_Begin(); @@ -282,7 +288,7 @@ echo '</tr> </thead><tbody>'; - foreach ($_SESSION['ReceiptBatch']->Items as $ReceiptItem) { + foreach ($_SESSION['ReceiptBatch' . $identifier]->Items as $ReceiptItem) { if ($k==1){ echo '<tr class="OddTableRows">'; @@ -296,14 +302,14 @@ $Result=DB_query($SQL); $myrow=DB_fetch_array($Result); - echo '<td>', $_SESSION['ReceiptBatch']->BatchNo, '</td> - <td>', $_SESSION['ReceiptBatch']->DateBanked, '</td> - <td>', $ReceiptItem->CustomerName, '</td> - <td class="text">', $ReceiptItem->GLCode, ' - ', $myrow['accountname'], '</td> - <td class="number">', locale_number_format($ReceiptItem->Amount/$_SESSION['ReceiptBatch']->ExRate/$_SESSION['ReceiptBatch']->FunctionalExRate,$_SESSION['ReceiptBatch']->CurrDecimalPlaces), '</td>'; + echo '<td>' . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . '</td> + <td>' . $_SESSION['ReceiptBatch' . $identifier]->DateBanked . '</td> + <td>' . $ReceiptItem->CustomerName . '</td> + <td class="text">' . $ReceiptItem->GLCode . ' - ' . $myrow['accountname'] . '</td> + <td class="number">' . locale_number_format($ReceiptItem->Amount/$_SESSION['ReceiptBatch' . $identifier]->ExRate/$_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate,$_SESSION['ReceiptBatch' . $identifier]->CurrDecimalPlaces) . '</td>'; if ($ReceiptItem->GLCode ==''){ - echo '<td class="noprint"><a target="_blank" href="', $RootPath, '/PDFReceipt.php?BatchNumber=', $_SESSION['ReceiptBatch']->BatchNo, '&ReceiptNumber=', $CustomerReceiptCounter, '">', _('Print a Customer Receipt'), '</a></td></tr>'; + echo '<td class="noprint"><a target="_blank" href="', $RootPath, '/PDFReceipt.php?BatchNumber=', $_SESSION['ReceiptBatch' . $identifier]->BatchNo, '&ReceiptNumber=', $CustomerReceiptCounter, '">', _('Print a Customer Receipt'), '</a></td></tr>'; $CustomerReceiptCounter += 1; } @@ -319,12 +325,12 @@ tag) VALUES ( 12, - '" . $_SESSION['ReceiptBatch']->BatchNo . "', - '" . FormatDateForSQL($_SESSION['ReceiptBatch']->DateBanked) . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . "', + '" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "', '" . $PeriodNo . "', '" . $ReceiptItem->GLCode . "', '" . $ReceiptItem->Narrative . "', - '" . -($ReceiptItem->Amount/$_SESSION['ReceiptBatch']->ExRate/$_SESSION['ReceiptBatch']->FunctionalExRate) . "', + '" . -($ReceiptItem->Amount/$_SESSION['ReceiptBatch' . $identifier]->ExRate/$_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate) . "', '" . $ReceiptItem->tag . "'" . " )"; $ErrMsg = _('Cannot insert a GL entry for the receipt because'); @@ -349,9 +355,9 @@ $TrfFromBankCurrCode = $TrfFromBankRow['currcode']; $TrfFromBankExRate = $TrfFromBankRow['rate']; - if ($_SESSION['ReceiptBatch']->AccountCurrency == $TrfFromBankCurrCode){ + if ($_SESSION['ReceiptBatch' . $identifier]->AccountCurrency == $TrfFromBankCurrCode){ /*Make sure to use the same rate if the transfer is between two bank accounts in the same currency */ - $TrfFromBankExRate = $_SESSION['ReceiptBatch']->FunctionalExRate; + $TrfFromBankExRate = $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate; } /*Consider an example - had to be currencies I am familar with sorry so I could figure it out!! @@ -398,12 +404,12 @@ 1, '" . $ReceiptItem->GLCode . "', '" . _('Act Transfer') ." - " . $ReceiptItem->Narrative . "', - '" . (($_SESSION['ReceiptBatch']->ExRate * $_SESSION['ReceiptBatch']->FunctionalExRate)/$TrfFromBankExRate). "', + '" . (($_SESSION['ReceiptBatch' . $identifier]->ExRate * $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate)/$TrfFromBankExRate). "', '" . $TrfFromBankExRate . "', - '" . FormatDateForSQL($_SESSION['ReceiptBatch']->DateBanked) . "', - '" . $_SESSION['ReceiptBatch']->ReceiptType . "', + '" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->ReceiptType . "', '" . -$ReceiptItem->Amount . "', - '" . $_SESSION['ReceiptBatch']->Currency . "' + '" . $_SESSION['ReceiptBatch' . $identifier]->Currency . "' )"; $DbgMsg = _('The SQL that failed to insert the bank transaction was'); @@ -413,7 +419,7 @@ } else { //its not a GL item - its a customer receipt then /*Accumulate the total debtors credit including discount */ - $BatchDebtorTotal += (($ReceiptItem->Discount + $ReceiptItem->Amount)/$_SESSION['ReceiptBatch']->ExRate/$_SESSION['ReceiptBatch']->FunctionalExRate); + $BatchDebtorTotal += (($ReceiptItem->Discount + $ReceiptItem->Amount)/$_SESSION['ReceiptBatch' . $identifier]->ExRate/$_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate); /*Create a DebtorTrans entry for each customer deposit */ /*The rate of exchange required here is the rate between the functional (home) currency and the customer receipt currency @@ -424,6 +430,7 @@ type, debtorno, branchcode, + order_, trandate, inputdate, prd, @@ -435,16 +442,17 @@ invtext, salesperson) VALUES ( - '" . $_SESSION['ReceiptBatch']->BatchNo . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . "', 12, '" . $ReceiptItem->Customer . "', '', - '" . FormatDateForSQL($_SESSION['ReceiptBatch']->DateBanked) . "', + '" . $ReceiptItem->ID . "', + '" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "', '" . date('Y-m-d H-i-s') . "', '" . $PeriodNo . "', - '" . $_SESSION['ReceiptBatch']->ReceiptType . ' ' . $ReceiptItem->PayeeBankDetail . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->ReceiptType . ' ' . $ReceiptItem->PayeeBankDetail . "', '', - '" . ($_SESSION['ReceiptBatch']->FunctionalExRate*$_SESSION['ReceiptBatch']->ExRate) . "', + '" . ($_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate*$_SESSION['ReceiptBatch' . $identifier]->ExRate) . "', '" . -$ReceiptItem->Amount . "', '" . -$ReceiptItem->Discount . "', '" . $ReceiptItem->Narrative. "', @@ -455,7 +463,7 @@ $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); $SQL = "UPDATE debtorsmaster - SET lastpaiddate = '" . FormatDateForSQL($_SESSION['ReceiptBatch']->DateBanked) . "', + SET lastpaiddate = '" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "', lastpaid='" . $ReceiptItem->Amount ."' WHERE debtorsmaster.debtorno='" . $ReceiptItem->Customer . "'"; @@ -464,8 +472,8 @@ $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); } //end of if its a customer receipt - $BatchDiscount += ($ReceiptItem->Discount/$_SESSION['ReceiptBatch']->ExRate/$_SESSION['ReceiptBatch']->FunctionalExRate); - $BatchReceiptsTotal += ($ReceiptItem->Amount/$_SESSION['ReceiptBatch']->ExRate/$_SESSION['ReceiptBatch']->FunctionalExRate); + $BatchDiscount += ($ReceiptItem->Discount/$_SESSION['ReceiptBatch' . $identifier]->ExRate/$_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate); + $BatchReceiptsTotal += ($ReceiptItem->Amount/$_SESSION['ReceiptBatch' . $identifier]->ExRate/$_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate); } /*end foreach $ReceiptItem */ echo '</tbody></table>'; @@ -484,15 +492,15 @@ currcode) VALUES ( 12, - '" . $_SESSION['ReceiptBatch']->BatchNo . "', - '" . $_SESSION['ReceiptBatch']->Account . "', - '" . $_SESSION['ReceiptBatch']->BankTransRef . "', - '" . $_SESSION['ReceiptBatch']->ExRate . "', - '" . $_SESSION['ReceiptBatch']->FunctionalExRate . "', - '" . FormatDateForSQL($_SESSION['ReceiptBatch']->DateBanked) . "', - '" . $_SESSION['ReceiptBatch']->ReceiptType . "', - '" . ($BatchReceiptsTotal * $_SESSION['ReceiptBatch']->FunctionalExRate * $_SESSION['ReceiptBatch']->ExRate) . "', - '" . $_SESSION['ReceiptBatch']->Currency . "' + '" . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->Account . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->BankTransRef . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->ExRate . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate . "', + '" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->ReceiptType . "', + '" . ($BatchReceiptsTotal * $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate * $_SESSION['ReceiptBatch' . $identifier]->ExRate) . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->Currency . "' )"; $DbgMsg = _('The SQL that failed to insert the bank account transaction was'); $ErrMsg = _('Cannot insert a bank transaction'); @@ -512,11 +520,11 @@ amount) VALUES ( 12, - '" . $_SESSION['ReceiptBatch']->BatchNo . "', - '" . FormatDateForSQL($_SESSION['ReceiptBatch']->DateBanked) . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . "', + '" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "', '" . $PeriodNo . "', - '" . $_SESSION['ReceiptBatch']->Account . "', - '" . $_SESSION['ReceiptBatch']->Narrative . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->Account . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->Narrative . "', '" . $BatchReceiptsTotal . "' )"; $DbgMsg = _('The SQL that failed to insert the GL transaction fro the bank account debit was'); @@ -536,11 +544,11 @@ amount) VALUES ( 12, - '" . $_SESSION['ReceiptBatch']->BatchNo . "', - '" . FormatDateForSQL($_SESSION['ReceiptBatch']->DateBanked) . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . "', + '" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "', '" . $PeriodNo . "', '". $_SESSION['CompanyRecord']['debtorsact'] . "', - '" . $_SESSION['ReceiptBatch']->Narrative . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->Narrative . "', '" . -$BatchDebtorTotal . "' )"; $DbgMsg = _('The SQL that failed to insert the GL transaction for the debtors account credit was'); @@ -560,18 +568,18 @@ amount) VALUES ( 12, - '" . $_SESSION['ReceiptBatch']->BatchNo . "', - '" . FormatDateForSQL($_SESSION['ReceiptBatch']->DateBanked) . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . "', + '" . FormatDateForSQL($_SESSION['ReceiptBatch' . $identifier]->DateBanked) . "', '" . $PeriodNo . "', '" . $_SESSION['CompanyRecord']['pytdiscountact'] . "', - '" . $_SESSION['ReceiptBatch']->Narrative . "', + '" . $_SESSION['ReceiptBatch' . $identifier]->Narrative . "', '" . $BatchDiscount . "' )"; $DbgMsg = _('The SQL that failed to insert the GL transaction for the payment discount debit was'); $ErrMsg = _('Cannot insert a GL transaction for the payment discount debit'); $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); } //end if there is some discount - EnsureGLEntriesBalance(12,$_SESSION['ReceiptBatch']->BatchNo,$db); + EnsureGLEntriesBalance(12,$_SESSION['ReceiptBatch' . $identifier]->BatchNo,$db); } //end if there is GL work to be done - ie config is to link to GL @@ -579,15 +587,15 @@ $DbgMsg = _('The SQL that failed was'); $result = DB_Txn_Commit(); echo '<br />'; - prnMsg( _('Receipt batch') . ' ' . $_SESSION['ReceiptBatch']->BatchNo . ' ' . _('has been successfully entered into the database'),'success'); + prnMsg( _('Receipt batch') . ' ' . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . ' ' . _('has been successfully entered into the database'),'success'); echo '<div class="centre noprint">', - '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a href="' . $RootPath . '/PDFBankingSummary.php?BatchNo=' . $_SESSION['ReceiptBatch']->BatchNo . '">' . _('Print PDF Batch Summary') . '</a></p>'; + '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a href="' . $RootPath . '/PDFBankingSummary.php?BatchNo=' . $_SESSION['ReceiptBatch' . $identifier]->BatchNo . '">' . _('Print PDF Batch Summary') . '</a></p>'; echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/allocation.png" title="' . _('Allocate') . '" alt="" />' . ' ' . '<a href="' . $RootPath . '/CustomerAllocations.php">' . _('Allocate Receipts') . '</a></p>'; echo '<p class="page_title_text"><img alt="" src="', $RootPath, '/css/', $Theme, '/images/transactions.png" title="', _('Enter Receipts'), '" /> ', '<a href="', $RootPath, '/CustomerReceipt.php?NewReceipt=Yes&Type=Customer">', _('Enter Receipts'), '</a></p>', '</div>'; - unset($_SESSION['ReceiptBatch']); + unset($_SESSION['ReceiptBatch' . $identifier]); include('includes/footer.inc'); exit; @@ -605,7 +613,7 @@ $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name FROM debtorsmaster - WHERE debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch']->Currency . "'"; + WHERE debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch' . $identifier]->Currency . "'"; } else { if (mb_strlen($_POST['Keywords'])>0) { //insert wildcard characters in spaces @@ -615,21 +623,21 @@ debtorsmaster.name FROM debtorsmaster WHERE debtorsmaster.name " . LIKE . " '". $SearchString . "' - AND debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch']->Currency . "'"; + AND debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch' . $identifier]->Currency . "'"; } elseif (mb_strlen($_POST['CustCode'])>0){ $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name FROM debtorsmaster WHERE debtorsmaster.debtorno " . LIKE . " '%" . $_POST['CustCode'] . "%' - AND debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch']->Currency . "'"; + AND debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch' . $identifier]->Currency . "'"; } elseif (mb_strlen($_POST['CustInvNo'])>0){ $SQL = "SELECT debtortrans.debtorno, debtorsmaster.name FROM debtorsmaster LEFT JOIN debtortrans ON debtorsmaster.debtorno=debtortrans.debtorno WHERE debtortrans.transno " . LIKE . " '%" . $_POST['CustInvNo'] . "%' - AND debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch']->Currency . "'"; + AND debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch' . $identifier]->Currency . "'"; } } if ($_SESSION['SalesmanLogin'] != '') { @@ -671,8 +679,8 @@ the receipt held entirely as session variables until the button clicked to process*/ - if (isset($_SESSION['CustomerRecord'])){ - unset($_SESSION['CustomerRecord']); + if (isset($_SESSION['CustomerRecord' . $identifier])){ + unset($_SESSION['CustomerRecord' . $identifier]); } $SQL = "SELECT debtorsmaster.name, @@ -764,20 +772,20 @@ $NIL_BALANCE = False; } - $_SESSION['CustomerRecord'] = DB_fetch_array($CustomerResult); + $_SESSION['CustomerRecord' . $identifier] = DB_fetch_array($CustomerResult); if ($NIL_BALANCE==True){ - $_SESSION['CustomerRecord']['balance']=0; - $_SESSION['CustomerRecord']['due']=0; - $_SESSION['CustomerRecord']['overdue1']=0; - $_SESSION['CustomerRecord']['overdue2']=0; + $_SESSION['CustomerRecord' . $identifier]['balance']=0; + $_SESSION['CustomerRecord' . $identifier]['due']=0; + $_SESSION['CustomerRecord' . $identifier]['overdue1']=0; + $_SESSION['CustomerRecord' . $identifier]['overdue2']=0; } } /*end of if customer has just been selected all info required read into $_SESSION['CustomerRecord']*/ /*set up the form whatever */ -echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Type='.$_GET['Type'] . '" method="post" id="form1">'; +echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Type='.$_GET['Type'] . '&identifier=' . $identifier . '" method="post" id="form1">'; echo '<div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -822,7 +830,7 @@ echo '<option value=""></option>'; while ($myrow=DB_fetch_array($AccountsResults)){ /*list the bank account names */ - if ($_SESSION['ReceiptBatch']->Account==$myrow['accountcode']){ + if ($_SESSION['ReceiptBatch' . $identifier]->Account==$myrow['accountcode']){ echo '<option selected="selected" value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . ' - ' . $myrow['currcode'] . '</option>'; } else { echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname']. ' - ' . $myrow['currcode'] . '</option>'; @@ -832,20 +840,20 @@ </tr>'; } -if (!Is_Date($_SESSION['ReceiptBatch']->DateBanked)){ - $_SESSION['ReceiptBatch']->DateBanked = Date($_SESSION['DefaultDateFormat']); +if (!Is_Date($_SESSION['ReceiptBatch' . $identifier]->DateBanked)){ + $_SESSION['ReceiptBatch' . $identifier]->DateBanked = Date($_SESSION['DefaultDateFormat']); } echo '<tr> <td>' . _('Date Banked') . ':</td> - <td><input tabindex="2" type="text" required="required" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="DateBanked" maxlength="10" size="10" onchange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['ReceiptBatch']->DateBanked . '" /></td> + <td><input tabindex="2" type="text" required="required" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="DateBanked" maxlength="10" size="10" onchange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_SESSION['ReceiptBatch' . $identifier]->DateBanked . '" /></td> </tr> <tr> <td>' . _('Currency') . ':</td> <td><select tabindex="3" name="Currency" onchange="ReloadForm(form1.BatchInput)">'; -if (!isset($_SESSION['ReceiptBatch']->Currency)){ - $_SESSION['ReceiptBatch']->Currency=$_SESSION['CompanyRecord']['currencydefault']; +if (!isset($_SESSION['ReceiptBatch' . $identifier]->Currency)){ + $_SESSION['ReceiptBatch' . $identifier]->Currency=$_SESSION['CompanyRecord']['currencydefault']; } $SQL = "SELECT currency, currabrev, rate FROM currencies"; @@ -857,7 +865,7 @@ } else { include('includes/CurrenciesArray.php'); // To get the currency name from the currency code. while ($myrow=DB_fetch_array($result)){ - if ($_SESSION['ReceiptBatch']->Currency==$myrow['currabrev']){ + if ($_SESSION['ReceiptBatch' . $identifier]->Currency==$myrow['currabrev']){ echo '<option selected="selected" value="' . $myrow['currabrev'] . '">' . $CurrencyName[$myrow['currabrev']] . '</option>'; } else { echo '<option value="' . $myrow['currabrev'] . '">' . $CurrencyName[$myrow['currabrev']] . '</option>'; @@ -868,37 +876,37 @@ } -if (!isset($_SESSION['ReceiptBatch']->ExRate)){ - $_SESSION['ReceiptBatch']->ExRate=1; +if (!isset($_SESSION['ReceiptBatch' . $identifier]->ExRate)){ + $_SESSION['ReceiptBatch' . $identifier]->ExRate=1; } -if (!isset($_SESSION['ReceiptBatch']->FunctionalExRate)){ - $_SESSION['ReceiptBatch']->FunctionalExRate=1; +if (!isset($_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate)){ + $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate=1; } -if($_SESSION['ReceiptBatch']->AccountCurrency != $_SESSION['ReceiptBatch']->Currency AND isset($_SESSION['ReceiptBatch']->AccountCurrency)) { - if($_SESSION['ReceiptBatch']->ExRate==1 AND isset($SuggestedExRate)) { - $_SESSION['ReceiptBatch']->ExRate = $SuggestedExRate; +if ($_SESSION['ReceiptBatch' . $identifier]->AccountCurrency != $_SESSION['ReceiptBatch' . $identifier]->Currency AND isset($_SESSION['ReceiptBatch' . $identifier]->AccountCurrency)) { + if($_SESSION['ReceiptBatch' . $identifier]->ExRate==1 AND isset($SuggestedExRate)) { + $_SESSION['ReceiptBatch' . $identifier]->ExRate = $SuggestedExRate; } elseif($_POST['Currency'] != $_POST['PreviousCurrency'] AND isset($SuggestedExRate)) {//the user has changed the currency, then we should revise suggested rate - $_SESSION['ReceiptBatch']->ExRate = $SuggestedExRate; + $_SESSION['ReceiptBatch' . $identifier]->ExRate = $SuggestedExRate; } if(isset($SuggestedExRate)) { - $SuggestedExRateText = '<b>' . _('Suggested rate:') . ' 1 ' . $_SESSION['ReceiptBatch']->AccountCurrency . ' = ' . locale_number_format($SuggestedExRate,8) . ' ' . $_SESSION['ReceiptBatch']->Currency . '</b>'; + $SuggestedExRateText = '<b>' . _('Suggested rate:') . ' 1 ' . $_SESSION['ReceiptBatch' . $identifier]->AccountCurrency . ' = ' . locale_number_format($SuggestedExRate,8) . ' ' . $_SESSION['ReceiptBatch']->Currency . '</b>'; } else { - $SuggestedExRateText = '<b>1 ' . $_SESSION['ReceiptBatch']->AccountCurrency . ' = ? ' . $_SESSION['ReceiptBatch']->Currency . '</b>'; + $SuggestedExRateText = '<b>1 ' . $_SESSION['ReceiptBatch' . $identifier]->AccountCurrency . ' = ? ' . $_SESSION['ReceiptBatch' . $identifier]->Currency . '</b>'; } echo '<tr> <td>', _('Receipt Exchange Rate'), ':</td> - <td><input class="number" maxlength="12" name="ExRate" required="required" size="14" tabindex="4" type="text" value="', locale_number_format($_SESSION['ReceiptBatch']->ExRate,8), '" /> ', $SuggestedExRateText, ' <i>', _('The exchange rate between the currency of the bank account currency and the currency of the receipt'), '.</i></td> + <td><input class="number" maxlength="12" name="ExRate" required="required" size="14" tabindex="4" type="text" value="', locale_number_format($_SESSION['ReceiptBatch' . $identifier]->ExRate,8), '" /> ', $SuggestedExRateText, ' <i>', _('The exchange rate between the currency of the bank account currency and the currency of the receipt'), '.</i></td> </tr>'; } -if($_SESSION['ReceiptBatch']->AccountCurrency != $_SESSION['CompanyRecord']['currencydefault'] AND isset($_SESSION['ReceiptBatch']->AccountCurrency)) { - if($_SESSION['ReceiptBatch']->FunctionalExRate==1 AND isset($SuggestedFunctionalExRate)) { - $_SESSION['ReceiptBatch']->FunctionalExRate = $SuggestedFunctionalExRate; +if($_SESSION['ReceiptBatch' . $identifier]->AccountCurrency != $_SESSION['CompanyRecord']['currencydefault'] AND isset($_SESSION['ReceiptBatch' . $identifier]->AccountCurrency)) { + if($_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate==1 AND isset($SuggestedFunctionalExRate)) { + $_SESSION['ReceiptBatch' . $identifier]->FunctionalExRate = $SuggestedFunctionalExRate; } if(isset($SuggestedFunctionalExRate)) { - $SuggestedFunctionalExRateText = '<b>' . _('Suggested rate:') . ' 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ' . locale_number_format($SuggestedFunctionalExRate,8) . ' ' . $_SESSION['ReceiptBatch']->AccountCurrency . '</b>'; + $SuggestedFunctionalExRateText = '<b>' . _('Suggested rate:') . ' 1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ' . locale_number_format($SuggestedFunctionalExRate,8) . ' ' . $_SESSION['ReceiptBatch' . $identifier]->AccountCurrency . '</b>'; } else { $SuggestedFunctionalExRateText = '<b>1 ' . $_SESSION['CompanyRecord']['currencydefault'] . ' = ? ' . $_SESSION['ReceiptBatch']->AccountCurrency . '</b>'; } @@ -927,24 +935,24 @@ </tr>'; /* Receipt (Bank Account) info to be inserted on banktrans.ref, varchar(50). */ -if (!isset($_SESSION['ReceiptBatch']->BankTransRef)) { - $_SESSION['ReceiptBatch']->BankTransRef=''; +if (!isset($_SESSION['ReceiptBatch' . $identifier]->BankTransRef)) { + $_SESSION['ReceiptBatch' . $identifier]->BankTransRef=''; } echo '<tr> <td>', _('Reference'), ':</td> - <td><input maxlength="50" name="BankTransRef" size="52" tabindex="7" type="text" value="', $_SESSION['ReceiptBatch']->BankTransRef,'" /> <i>', _('Reference on Bank Transactions Inquiry'), '.</i></td> + <td><input maxlength="50" name="BankTransRef" size="52" tabindex="7" type="text" value="', $_SESSION['ReceiptBatch' . $identifier]->BankTransRef,'" /> <i>', _('Reference on Bank Transactions Inquiry'), '.</i></td> </tr>'; /* Receipt (Bank Account) info to be inserted on gltrans.narrative, varchar(200). */ -if (!isset($_SESSION['ReceiptBatch']->Narrative)) { - $_SESSION['ReceiptBatch']->Narrative=''; +if (!isset($_SESSION['ReceiptBatch' . $identifier]->Narrative)) { + $_SESSION['ReceiptBatch' . $identifier]->Narrative=''; } if (!isset($_POST['Currency'])){ $_POST['Currency'] = $_SESSION['CompanyRecord']['currencydefault']; } echo '<tr> <td>', _('Narrative'), ':</td> - <td><input maxlength="200" name="BatchNarrative" size="52" tabindex="8" type="text" value="', $_SESSION['ReceiptBatch']->Narrative, '" /> <i>', _('Narrative on General Ledger Account Inquiry'), '.</i></td> + <td><input maxlength="200" name="BatchNarrative" size="52" tabindex="8" type="text" value="', $_SESSION['ReceiptBatch' . $identifier]->Narrative, '" /> <i>', _('Narrative on General Ledger Account Inquiry'), '.</i></td> </tr> <input name="PreviousCurrency" type="hidden" value="', $_POST['Currency'], '" /> <tr> @@ -957,12 +965,12 @@ </table> <br />'; -if (isset($_SESSION['ReceiptBatch'])){ +if (isset($_SESSION['ReceiptBatch' . $identifier])){ /* Now show the entries made so far */ if (!$BankAccountEmpty) { echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/transactions.png" title="' . _('Banked') . '" alt="" /> - ' . ' ' . $_SESSION['ReceiptBatch']->ReceiptType . ' - ' . _('Banked into the') . " " . - $_SESSION['ReceiptBatch']->BankAccountName . ' ' . _('on') . ' ' . $_SESSION['ReceiptBatch']->DateBanked . '</p>'; + ' . ' ' . $_SESSION['ReceiptBatch' . $identifier]->ReceiptType . ' - ' . _('Banked into the') . " " . + $_SESSION['ReceiptBatch' . $identifier]->BankAccountName . ' ' . _('on') . ' ' . $_SESSION['ReceiptBatch' . $identifier]->DateBanked . '</p>'; } echo '<table width="90%" class="selection"> @@ -977,15 +985,15 @@ $BatchTotal = 0; - foreach ($_SESSION['ReceiptBatch']->Items as $ReceiptItem) { + foreach ($_SESSION['ReceiptBatch' . $identifier]->Items as $ReceiptItem) { $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $ReceiptItem->GLCode . "'"; $Result=DB_query($SQL); $myrow=DB_fetch_array($Result); echo '<tr> - <td class="number">' . locale_number_format($ReceiptItem->Amount,$_SESSION['ReceiptBatch']->CurrDecimalPlaces) . '</td> - <td class="number">' . locale_number_format($ReceiptItem->Discount,$_SESSION['ReceiptBatch']->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($ReceiptItem->Amount,$_SESSION['ReceiptBatch' . $identifier]->CurrDecimalPlaces) . '</td> + <td class="number">' . locale_number_format($ReceiptItem->Discount,$_SESSION['ReceiptBatch' . $identifier]->CurrDecimalPlaces) . '</td> <td>' . stripslashes($ReceiptItem->CustomerName) . '</td> <td>' . $ReceiptItem->GLCode.' - '.$myrow['accountname'] . '</td> <td>' . stripslashes($ReceiptItem->Narrative) . '</td> @@ -996,7 +1004,7 @@ } echo '<tr> - <td class="number"><b>' . locale_number_format($BatchTotal,$_SESSION['ReceiptBatch']->CurrDecimalPlaces) . '</b></td> + <td class="number"><b>' . locale_number_format($BatchTotal,$_SESSION['ReceiptBatch' . $identifier]->CurrDecimalPlaces) . '</b></td> </tr> </table>'; } @@ -1012,22 +1020,22 @@ then set out the customers account summary */ -if (isset($_SESSION['CustomerRecord']) - AND $_SESSION['CustomerRecord']['currcode'] != $_SESSION['ReceiptBatch']->Currency){ +if (isset($_SESSION['CustomerRecord' . $identifier]) + AND $_SESSION['CustomerRecord' . $identifier]['currcode'] != $_SESSION['ReceiptBatch' . $identifier]->Currency){ prnMsg(_('The selected customer does not trade in the currency of the receipt being entered - either the currency of the receipt needs to be changed or a different customer selected'),'warn'); - unset($_SESSION['CustomerRecord']); + unset($_SESSION['CustomerRecord' . $identifier]); } -if (isset($_SESSION['CustomerRecord']) +if (isset($_SESSION['CustomerRecord' . $identifier]) AND isset($_POST['CustomerID']) AND $_POST['CustomerID']!='' - AND isset($_SESSION['ReceiptBatch'])){ + AND isset($_SESSION['ReceiptBatch' . $identifier])){ /*a customer is selected */ echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . $_SESSION['CustomerRecord']['name'] . ' - (' . _('All amounts stated in') . ' ' . $_SESSION['CustomerRecord']['currency'] . ')' . _('Terms') . ': ' . $_SESSION['CustomerRecord']['terms'] . '<br/>' . _('Credit Limit') . ': ' . locale_number_format($_SESSION['CustomerRecord']['creditlimit'],0) . ' ' . _('Credit Status') . ': ' . $_SESSION['CustomerRecord']['reasondescription']; - if ($_SESSION['CustomerRecord']['dissallowinvoices']!=0){ + if ($_SESSION['CustomerRecord' . $identifier]['dissallowinvoices']!=0){ echo '<br /> <font color="red" size="4"><b>' . _('ACCOUNT ON HOLD') . '</font></b> <br/>'; @@ -1044,11 +1052,11 @@ </tr>'; echo '<tr> - <td class="number">' . locale_number_format($_SESSION['CustomerRecord']['balance'],$_SESSION['CustomerRecord']['currdecimalplaces']) . '</td> - <td class="number">' . locale_number_format(($_SESSION['CustomerRecord']['balance'] - $_SESSION['CustomerRecord']['due']),$_SESSION['CustomerRecord']['currdecimalplaces']) . '</td> - <td class="number">' . locale_number_format(($_SESSION['CustomerRecord']['due']-$_SESSION['CustomerRecord']['overdue1']),$_SESSION['CustomerRecord']['currdecimalplaces']) . '</td> - <td class="number">' . locale_number_format(($_SESSION['CustomerRecord']['overdue1']-$_SESSION['CustomerRecord']['overdue2']) ,$_SESSION['CustomerRecord']['currdecimalplaces']) . '</td> - <td class="number">' . locale_number_format($_SESSION['CustomerRecord']['overdue2'],$_SESSION['CustomerRecord']['currdecimalplaces']) . '</td> + <td class="number">' . locale_number_format($_SESSION['CustomerRecord' . $identifier]['balance'],$_SESSION['CustomerRecord' . $identifier]['currdecimalplaces']) . '</td> + <td class="number">' . locale_number_format(($_SESSION['CustomerRecord' . $identifier]['balance'] - $_SESSION['CustomerRecord' . $identifier]['due']),$_SESSION['CustomerRecord' . $identifier]['currdecimalplaces']) . '</td> + <td class="number">' . locale_number_format(($_SESSION['CustomerRecord' . $identifier]['due']-$_SESSION['CustomerRecord' . $identifier]['overdue1']),$_SESSION['CustomerRecord' . $identifier]['currdecimalplaces']) . '</td> + <td class="number">' . locale_number_format(($_SESSION['CustomerRecord' . $identifier]['overdue1']-$_SESSION['CustomerRecord' . $identifier]['overdue2']) ,$_SESSION['CustomerRecord' . $identifier]['currdecimalplaces']) . '</td> + <td class="number">' . locale_number_format($_SESSION['CustomerRecord' . $identifier]['overdue2'],$_SESSION['CustomerRecord' . $identifier]['currdecimalplaces']) . '</td> <td><a href="CustomerInquiry.php?CustomerID=' . $_POST['CustomerID'] . '&Status=0" target="_blank">' . _('Inquiry') . '</td> </tr> </table> @@ -1056,10 +1064,10 @@ echo '<table class="selection">'; - $DisplayDiscountPercent = locale_number_format($_SESSION['CustomerRecord']['pymtdiscount']*100,2) . '%'; + $DisplayDiscountPercent = locale_number_format($_SESSION['CustomerRecord' . $identifier]['pymtdiscount']*100,2) . '%'; echo '<input type="hidden" name="CustomerID" value="' . $_POST['CustomerID'] . '" />'; - echo '<input type="hidden" name="CustomerName" value="' . $_SESSION['CustomerRecord']['name'] . '" />'; + echo '<input type="hidden" name="CustomerName" value="' . $_SESSION['CustomerRecord' . $identifier]['name'] . '" />'; } @@ -1125,11 +1133,11 @@ /*if either a customer is selected or its a GL Entry then set out the fields for entry of receipt amt, disc, payee details, narrative */ -if (((isset($_SESSION['CustomerRecord']) +if (((isset($_SESSION['CustomerRecord' . $identifier]) AND isset($_POST['CustomerID']) AND $_POST['CustomerID']!='') OR isset($_POST['GLEntry'])) - AND isset($_SESSION['ReceiptBatch'])){ + AND isset($_SESSION['ReceiptBatch' . $identifier])){ if (!isset($_POST['Amount'])) { $_POST['Amount']=0; @@ -1172,7 +1180,7 @@ <input tabindex="15" type="submit" name="Cancel" value="' . _('Cancel') . '" /> </div>'; -} elseif (isset($_SESSION['ReceiptBatch']) +} elseif (isset($_SESSION['ReceiptBatch' . $identifier]) AND !isset($_POST['GLEntry'])){ /*Show the form to select a customer */ @@ -1242,7 +1250,7 @@ } //end if results to show } -if (isset($_SESSION['ReceiptBatch']->Items) AND count($_SESSION['ReceiptBatch']->Items) > 0){ +if (isset($_SESSION['ReceiptBatch' . $identifier]->Items) AND count($_SESSION['ReceiptBatch' . $identifier]->Items) > 0){ echo '<div class="centre"> <br/> <input tabindex="13" type="submit" name="CommitBatch" value="' . _('Accept and Process Batch') . '" /> |
From: <ex...@us...> - 2016-06-29 05:35:25
|
Revision: 7561 http://sourceforge.net/p/web-erp/reponame/7561 Author: exsonqu Date: 2016-06-29 05:35:22 +0000 (Wed, 29 Jun 2016) Log Message: ----------- 29/06/16 Exson: Fixed bug of wrong balance in account currency and display original currency code with amount in DailyBankTransactions.php. Modified Paths: -------------- trunk/DailyBankTransactions.php Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2016-06-20 06:56:54 UTC (rev 7560) +++ trunk/DailyBankTransactions.php 2016-06-29 05:35:22 UTC (rev 7561) @@ -152,7 +152,7 @@ <th class="number">' . _('Number') . '</th> <th class="text">' . _('Type') . '</th> <th class="text">' . _('Reference') . '</th> - <th class="number">' . _('Amount in org').' '.$BankDetailRow['currcode'] . '</th> + <th class="number">' . _('Amount in org currency') . '</th> <th class="number">' . _('Balance in') . ' ' . $BankDetailRow['currcode'] . '</th> <th class="number">' . _('Running Total').' '.$BankDetailRow['currcode'] . '</th> <th class="number">' . _('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'] . '</th> @@ -203,9 +203,8 @@ } else { $GLNarrative = 'NA'; } - $Balance += $myrow['amount']; - - $AccountCurrTotal += $myrow['amount']; + $Balance += $myrow['amount']/$myrow['exrate']; + $AccountCurrTotal += $myrow['amount']/$myrow['exrate']; $LocalCurrTotal += $myrow['amount']/$myrow['functionalexrate']/$myrow['exrate']; if ($myrow['amount']==$myrow['amountcleared']) { @@ -220,7 +219,7 @@ <td class="number"><a href="' . $RootPath . '/GLTransInquiry.php?TypeID=' . $myrow['typeid'] . '&TransNo=' . $myrow['transno'] . '">' . $myrow['transno'] . '</a></td> <td>' . $myrow['banktranstype'] . '</td> <td>' . $myrow['ref'] . '</td> - <td class="number">' . locale_number_format($myrow['amount'],$BankDetailRow['decimalplaces']) . '</td> + <td class="number">' . locale_number_format($myrow['amount'],$BankDetailRow['decimalplaces']) . ' ' . $myrow['currcode'] . '</td> <td class="number">' . locale_number_format($Balance,$BankDetailRow['decimalplaces']) . '</td> <td class="number">' . locale_number_format($AccountCurrTotal,$BankDetailRow['decimalplaces']) . '</td> <td class="number">' . locale_number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> |
From: <ex...@us...> - 2016-06-20 06:56:56
|
Revision: 7560 http://sourceforge.net/p/web-erp/reponame/7560 Author: exsonqu Date: 2016-06-20 06:56:54 +0000 (Mon, 20 Jun 2016) Log Message: ----------- Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-06-20 06:54:39 UTC (rev 7559) +++ trunk/doc/Change.log 2016-06-20 06:56:54 UTC (rev 7560) @@ -1,5 +1,6 @@ webERP Change Log - +20/06/16 Exson: Fixed bom clone failure due to fields missing in CopyBom.php. Reported by shane. +20/06/16 Exson: Fixed the bug that # is not allowed as part of stockid in SelectProduct.php. 16/06/16 Exson: Make monthly payment term can be more than 30 days. 12/06/16 TurboPT: Fix syntax error in StockClone.php 08/06/16 Exson: add data label for SalesGraph.php. |
From: <ex...@us...> - 2016-06-20 06:54:42
|
Revision: 7559 http://sourceforge.net/p/web-erp/reponame/7559 Author: exsonqu Date: 2016-06-20 06:54:39 +0000 (Mon, 20 Jun 2016) Log Message: ----------- 20/06/16 Exson: Fixed the bug that # is not allowed as part of stockid in SelectProduct.php. Modified Paths: -------------- trunk/SelectProduct.php Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2016-06-20 06:40:21 UTC (rev 7558) +++ trunk/SelectProduct.php 2016-06-20 06:54:39 UTC (rev 7559) @@ -370,7 +370,7 @@ echo '<td class="select">' . _('No') . '</td>'; } echo '<td class="select"><a href="' . $RootPath . '/PO_Header.php?NewOrder=Yes&SelectedSupplier=' . - $SuppRow['supplierid'] . '&StockID=' . $StockID . '&Quantity='.$SuppRow['minorderqty'].'&LeadTime='.$SuppRow['leadtime'] . '">' . _('Order') . ' </a></td>'; + $SuppRow['supplierid'] . '&StockID=' . urlencode($StockID) . '&Quantity='.$SuppRow['minorderqty'].'&LeadTime='.$SuppRow['leadtime'] . '">' . _('Order') . ' </a></td>'; echo '</tr>'; } echo '</table>'; @@ -389,34 +389,34 @@ <tr> <td valign="top" class="select">'; /*Stock Inquiry Options */ -echo '<a href="' . $RootPath . '/StockMovements.php?StockID=' . $StockID . '">' . _('Show Stock Movements') . '</a><br />'; +echo '<a href="' . $RootPath . '/StockMovements.php?StockID=' . urlencode($StockID) . '">' . _('Show Stock Movements') . '</a><br />'; if ($Its_A_Kitset_Assembly_Or_Dummy == False) { - echo '<a href="' . $RootPath . '/StockStatus.php?StockID=' . $StockID . '">' . _('Show Stock Status') . '</a><br />'; - echo '<a href="' . $RootPath . '/StockUsage.php?StockID=' . $StockID . '">' . _('Show Stock Usage') . '</a><br />'; + echo '<a href="' . $RootPath . '/StockStatus.php?StockID=' . urlencode($StockID) . '">' . _('Show Stock Status') . '</a><br />'; + echo '<a href="' . $RootPath . '/StockUsage.php?StockID=' . urlencode($StockID) . '">' . _('Show Stock Usage') . '</a><br />'; } -echo '<a href="' . $RootPath . '/SelectSalesOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a><br />'; -echo '<a href="' . $RootPath . '/SelectCompletedOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a><br />'; +echo '<a href="' . $RootPath . '/SelectSalesOrder.php?SelectedStockItem=' . urlencode($StockID) . '">' . _('Search Outstanding Sales Orders') . '</a><br />'; +echo '<a href="' . $RootPath . '/SelectCompletedOrder.php?SelectedStockItem=' . urlencode($StockID) . '">' . _('Search Completed Sales Orders') . '</a><br />'; if ($Its_A_Kitset_Assembly_Or_Dummy == False) { - echo '<a href="' . $RootPath . '/PO_SelectOSPurchOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Purchase Orders') . '</a><br />'; - echo '<a href="' . $RootPath . '/PO_SelectPurchOrder.php?SelectedStockItem=' . $StockID . '">' . _('Search All Purchase Orders') . '</a><br />'; + echo '<a href="' . $RootPath . '/PO_SelectOSPurchOrder.php?SelectedStockItem=' . urlencode($StockID) . '">' . _('Search Outstanding Purchase Orders') . '</a><br />'; + echo '<a href="' . $RootPath . '/PO_SelectPurchOrder.php?SelectedStockItem=' . urlencode($StockID) . '">' . _('Search All Purchase Orders') . '</a><br />'; $SupportedImgExt = array('png','jpg','jpeg'); $imagefile = reset((glob($_SESSION['part_pics_dir'] . '/' . $StockID . '.{' . implode(",", $SupportedImgExt) . '}', GLOB_BRACE))); echo '<a href="' . $RootPath . '/' . $imagefile . '" target="_blank">' . _('Show Part Picture (if available)') . '</a><br />'; } if ($Its_A_Dummy == False) { - echo '<a href="' . $RootPath . '/BOMInquiry.php?StockID=' . $StockID . '">' . _('View Costed Bill Of Material') . '</a><br />'; - echo '<a href="' . $RootPath . '/WhereUsedInquiry.php?StockID=' . $StockID . '">' . _('Where This Item Is Used') . '</a><br />'; + echo '<a href="' . $RootPath . '/BOMInquiry.php?StockID=' . urlencode($StockID) . '">' . _('View Costed Bill Of Material') . '</a><br />'; + echo '<a href="' . $RootPath . '/WhereUsedInquiry.php?StockID=' . urlencode($StockID) . '">' . _('Where This Item Is Used') . '</a><br />'; } if ($Its_A_Labour_Item == True) { - echo '<a href="' . $RootPath . '/WhereUsedInquiry.php?StockID=' . $StockID . '">' . _('Where This Labour Item Is Used') . '</a><br />'; + echo '<a href="' . $RootPath . '/WhereUsedInquiry.php?StockID=' . urlencode($StockID) . '">' . _('Where This Labour Item Is Used') . '</a><br />'; } wikiLink('Product', $StockID); echo '</td><td valign="top" class="select">'; /* Stock Transactions */ if ($Its_A_Kitset_Assembly_Or_Dummy == false) { - echo '<a href="' . $RootPath . '/StockAdjustments.php?StockID=' . $StockID . '">' . _('Quantity Adjustments') . '</a><br />'; - echo '<a href="' . $RootPath . '/StockTransfers.php?StockID=' . $StockID . '&NewTransfer=true">' . _('Location Transfers') . '</a><br />'; + echo '<a href="' . $RootPath . '/StockAdjustments.php?StockID=' . urlencode($StockID) . '">' . _('Quantity Adjustments') . '</a><br />'; + echo '<a href="' . $RootPath . '/StockTransfers.php?StockID=' . urlencode($StockID) . '&NewTransfer=true">' . _('Location Transfers') . '</a><br />'; //show the item image if it has been uploaded if ( extension_loaded ('gd') && function_exists ('gd_info') && file_exists ($imagefile) ) { @@ -464,7 +464,7 @@ } else { $EOQ = $myrow['eoq']; } - echo '<a href="' . $RootPath . '/PO_Header.php?NewOrder=Yes' . '&SelectedSupplier=' . $SuppRow['supplierid'] . '&StockID=' . $StockID . '&Quantity='.$EOQ.'&LeadTime='.$SuppRow['leadtime'].'">' . _('Purchase this Item from') . ' ' . $SuppRow['suppname'] . '</a> + echo '<a href="' . $RootPath . '/PO_Header.php?NewOrder=Yes' . '&SelectedSupplier=' . $SuppRow['supplierid'] . '&StockID=' . urlencode($StockID) . '&Quantity='.$EOQ.'&LeadTime='.$SuppRow['leadtime'].'">' . _('Purchase this Item from') . ' ' . $SuppRow['suppname'] . '</a> <br />'; $LastSupplierShown = $SuppRow['supplierid']; } @@ -475,27 +475,27 @@ echo '</td><td valign="top" class="select">'; /* Stock Maintenance Options */ echo '<a href="' . $RootPath . '/Stocks.php?">' . _('Insert New Item') . '</a><br />'; -echo '<a href="' . $RootPath . '/Stocks.php?StockID=' . $StockID . '">' . _('Modify Item Details') . '</a><br />'; +echo '<a href="' . $RootPath . '/Stocks.php?StockID=' . urlencode($StockID) . '">' . _('Modify Item Details') . '</a><br />'; if ($Its_A_Kitset_Assembly_Or_Dummy == False) { - echo '<a href="' . $RootPath . '/StockReorderLevel.php?StockID=' . $StockID . '">' . _('Maintain Reorder Levels') . '</a><br />'; - echo '<a href="' . $RootPath . '/StockCostUpdate.php?StockID=' . $StockID . '">' . _('Maintain Standard Cost') . '</a><br />'; - echo '<a href="' . $RootPath . '/PurchData.php?StockID=' . $StockID . '">' . _('Maintain Purchasing Data') . '</a><br />'; - echo '<a href="' . $RootPath . '/CustItem.php?StockID=' . $StockID . '">' . _('Maintain Customer Item Data') . '</a><br />'; + echo '<a href="' . $RootPath . '/StockReorderLevel.php?StockID=' . urlencode($StockID) . '">' . _('Maintain Reorder Levels') . '</a><br />'; + echo '<a href="' . $RootPath . '/StockCostUpdate.php?StockID=' . urlencode($StockID) . '">' . _('Maintain Standard Cost') . '</a><br />'; + echo '<a href="' . $RootPath . '/PurchData.php?StockID=' . urlencode($StockID) . '">' . _('Maintain Purchasing Data') . '</a><br />'; + echo '<a href="' . $RootPath . '/CustItem.php?StockID=' . urlencode($StockID) . '">' . _('Maintain Customer Item Data') . '</a><br />'; } if ($Its_A_Labour_Item == True) { - echo '<a href="' . $RootPath . '/StockCostUpdate.php?StockID=' . $StockID . '">' . _('Maintain Standard Cost') . '</a><br />'; + echo '<a href="' . $RootPath . '/StockCostUpdate.php?StockID=' . urlencode($StockID) . '">' . _('Maintain Standard Cost') . '</a><br />'; } if (!$Its_A_Kitset) { - echo '<a href="' . $RootPath . '/Prices.php?Item=' . $StockID . '">' . _('Maintain Pricing') . '</a><br />'; + echo '<a href="' . $RootPath . '/Prices.php?Item=' . urlencode($StockID) . '">' . _('Maintain Pricing') . '</a><br />'; if (isset($_SESSION['CustomerID']) AND $_SESSION['CustomerID'] != '' AND mb_strlen($_SESSION['CustomerID']) > 0) { - echo '<a href="' . $RootPath . '/Prices_Customer.php?Item=' . $StockID . '">' . _('Special Prices for customer') . ' - ' . $_SESSION['CustomerID'] . '</a><br />'; + echo '<a href="' . $RootPath . '/Prices_Customer.php?Item=' . urlencode($StockID) . '">' . _('Special Prices for customer') . ' - ' . $_SESSION['CustomerID'] . '</a><br />'; } - echo '<a href="' . $RootPath . '/DiscountCategories.php?StockID=' . $StockID . '">' . _('Maintain Discount Category') . '</a><br />'; - echo '<a href="' . $RootPath . '/StockClone.php?OldStockID=' . $StockID . '">' . _('Clone This Item') . '</a><br />'; - echo '<a href="' . $RootPath . '/RelatedItemsUpdate.php?Item=' . $StockID . '">' . _('Maintain Related Items') . '</a><br />'; - echo '<a href="' . $RootPath . '/PriceMatrix.php?StockID=' . $StockID . '">' . _('Maintain Price Matrix') . '</a><br />'; + echo '<a href="' . $RootPath . '/DiscountCategories.php?StockID=' . urlencode($StockID) . '">' . _('Maintain Discount Category') . '</a><br />'; + echo '<a href="' . $RootPath . '/StockClone.php?OldStockID=' . urlencode($StockID) . '">' . _('Clone This Item') . '</a><br />'; + echo '<a href="' . $RootPath . '/RelatedItemsUpdate.php?Item=' . urlencode($StockID) . '">' . _('Maintain Related Items') . '</a><br />'; + echo '<a href="' . $RootPath . '/PriceMatrix.php?StockID=' . urlencode($StockID) . '">' . _('Maintain Price Matrix') . '</a><br />'; } echo '</td></tr></table>'; } else { @@ -862,7 +862,7 @@ <td title="'. $myrow['longdescription'] . '">' . $myrow['description'] . '</td> <td class="number">' . $qoh . '</td> <td>' . $myrow['units'] . '</td> - <td><a target="_blank" href="' . $RootPath . '/StockStatus.php?StockID=' . $myrow['stockid'].'">' . _('View') . '</a></td> + <td><a target="_blank" href="' . $RootPath . '/StockStatus.php?StockID=' . urlencode($myrow['stockid']).'">' . _('View') . '</a></td> </tr>'; /* $j++; |
From: <ex...@us...> - 2016-06-20 06:40:23
|
Revision: 7558 http://sourceforge.net/p/web-erp/reponame/7558 Author: exsonqu Date: 2016-06-20 06:40:21 +0000 (Mon, 20 Jun 2016) Log Message: ----------- 20/06/16 Exson: Fixed the bug of missing fields in CopyBOM.php. Reported by Shane. Modified Paths: -------------- trunk/CopyBOM.php Modified: trunk/CopyBOM.php =================================================================== --- trunk/CopyBOM.php 2016-06-16 11:12:38 UTC (rev 7557) +++ trunk/CopyBOM.php 2016-06-20 06:40:21 UTC (rev 7558) @@ -129,7 +129,9 @@ effectiveto, quantity, autoissue, - remark + remark, + digitals, + decimalplaces FROM bom WHERE parent='".$StockID."';"; $result = DB_query($sql); |
From: <ex...@us...> - 2016-06-16 11:12:40
|
Revision: 7557 http://sourceforge.net/p/web-erp/reponame/7557 Author: exsonqu Date: 2016-06-16 11:12:38 +0000 (Thu, 16 Jun 2016) Log Message: ----------- Modified Paths: -------------- trunk/doc/Change.log Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2016-06-16 11:11:45 UTC (rev 7556) +++ trunk/doc/Change.log 2016-06-16 11:12:38 UTC (rev 7557) @@ -1,5 +1,6 @@ webERP Change Log +16/06/16 Exson: Make monthly payment term can be more than 30 days. 12/06/16 TurboPT: Fix syntax error in StockClone.php 08/06/16 Exson: add data label for SalesGraph.php. |
From: <ex...@us...> - 2016-06-16 11:11:48
|
Revision: 7556 http://sourceforge.net/p/web-erp/reponame/7556 Author: exsonqu Date: 2016-06-16 11:11:45 +0000 (Thu, 16 Jun 2016) Log Message: ----------- 16/06/16 Exson: Make monthly payment term can be more than 30 days. Modified Paths: -------------- trunk/AgedDebtors.php trunk/AgedSuppliers.php trunk/CustomerInquiry.php trunk/CustomerReceipt.php trunk/Dashboard.php trunk/PaymentTerms.php trunk/PrintCustStatements.php trunk/SupplierInquiry.php Modified: trunk/AgedDebtors.php =================================================================== --- trunk/AgedDebtors.php 2016-06-13 15:30:45 UTC (rev 7555) +++ trunk/AgedDebtors.php 2016-06-16 11:11:45 UTC (rev 7556) @@ -45,8 +45,9 @@ 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') .")) >= 0 - THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= 0 + THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc + ELSE 0 END END ) AS due, SUM( @@ -55,7 +56,7 @@ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) > paymentterms.daysbeforedue 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(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END @@ -66,7 +67,7 @@ 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'] . " + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays2'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END @@ -116,7 +117,7 @@ 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') . ")) >= 0 ) + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END ) AS due, @@ -127,7 +128,7 @@ 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(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END @@ -139,7 +140,7 @@ 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'] . ") + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays2'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END @@ -173,7 +174,7 @@ 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(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END @@ -201,7 +202,7 @@ 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') . ")) >= 0) + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END @@ -213,7 +214,7 @@ 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(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END @@ -226,7 +227,7 @@ 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'] . ") + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= ".$_SESSION['PastDueDays2'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END @@ -324,31 +325,31 @@ (debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc) as balance, (CASE WHEN (paymentterms.daysbeforedue > 0) THEN - (CASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) >= paymentterms.daysbeforedue + 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) + 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') . ")) >= 0 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc - ELSE 0 END) + ELSE 0 END END) AS due, (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'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END) + CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue 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(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc - ELSE 0 END) + ELSE 0 END END) AS overdue1, (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['PastDueDays2'] . ") + 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 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'] . ") + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays2'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc - ELSE 0 END) + ELSE 0 END END) AS overdue2 FROM debtorsmaster, paymentterms, Modified: trunk/AgedSuppliers.php =================================================================== --- trunk/AgedSuppliers.php 2016-06-13 15:30:45 UTC (rev 7555) +++ trunk/AgedSuppliers.php 2016-06-16 11:11:45 UTC (rev 7556) @@ -29,17 +29,17 @@ 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 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= 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 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_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 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_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 @@ -69,17 +69,17 @@ 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 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= 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 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_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 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_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 @@ -98,7 +98,7 @@ 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"; + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . " THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END)) > 0"; } @@ -167,17 +167,17 @@ 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 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= 0 THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END END AS due, 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 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate), paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . " THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END END AS overdue1, 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 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays2'] . " THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END END AS overdue2 FROM suppliers LEFT JOIN paymentterms @@ -332,4 +332,4 @@ include('includes/footer.inc'); } /*end of else not PrintPDF */ -?> \ No newline at end of file +?> Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2016-06-13 15:30:45 UTC (rev 7555) +++ trunk/CustomerInquiry.php 2016-06-16 11:11:45 UTC (rev 7556) @@ -77,14 +77,14 @@ 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 ELSE - CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1', 'MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))', 'DAY') . ")) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END 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'] . ") 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(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END) AS overdue1, @@ -92,7 +92,7 @@ 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(ADDDATE(last_day(debtortrans.trandate),paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays2'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END) AS overdue2 FROM debtorsmaster, paymentterms, Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2016-06-13 15:30:45 UTC (rev 7555) +++ trunk/CustomerReceipt.php 2016-06-16 11:11:45 UTC (rev 7556) @@ -689,17 +689,17 @@ 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 ELSE - CASE WHEN TO_DAYS(Now()) - TO_DAYS(DATE_ADD(DATE_ADD(debtortrans.trandate, " . INTERVAL('1','MONTH') . "), " . INTERVAL('(paymentterms.dayinfollowingmonth - DAYOFMONTH(debtortrans.trandate))','DAY') . ")) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate), paymentterms.dayinfollowingmonth)) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END 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'] . ") 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'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate), paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END) AS overdue1, 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['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(ADDDATE(last_day(debtortrans.trandate), paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays2'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END) AS overdue2 FROM debtorsmaster INNER JOIN paymentterms ON debtorsmaster.paymentterms = paymentterms.termsindicator Modified: trunk/Dashboard.php =================================================================== --- trunk/Dashboard.php 2016-06-13 15:30:45 UTC (rev 7555) +++ trunk/Dashboard.php 2016-06-16 11:11:45 UTC (rev 7556) @@ -92,7 +92,7 @@ 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') .")) >= 0 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate), paymentterms.dayinfollowingmonth)) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END ) AS due, @@ -102,7 +102,7 @@ CASE WHEN (TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate)) > paymentterms.daysbeforedue 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(ADDDATE(last_day(debtortrans.trandate), paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END @@ -113,7 +113,7 @@ 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'] . " + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate), paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays2'] . " THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END END @@ -215,7 +215,7 @@ 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') . ")) >= 0 + (CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(ADDDATE(last_day(debtortrans.trandate), 1), paymentterms.dayinfollowingmonth)) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END) END) AS due, @@ -223,7 +223,7 @@ THEN (CASE WHEN TO_DAYS(Now()) - TO_DAYS(debtortrans.trandate) > paymentterms.daysbeforedue 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(ADDDATE(ADDDATE(last_day(debtortrans.trandate), 1), paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END) END) AS overdue1, @@ -233,7 +233,7 @@ 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'] . ") + (CASE WHEN (TO_DAYS(Now()) - TO_DAYS(ADDDATE(ADDDATE(last_day(debtortrans.trandate), 1), paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END) END) AS overdue2 Modified: trunk/PaymentTerms.php =================================================================== --- trunk/PaymentTerms.php 2016-06-13 15:30:45 UTC (rev 7555) +++ trunk/PaymentTerms.php 2016-06-16 11:11:45 UTC (rev 7556) @@ -59,13 +59,13 @@ $Errors[$i] = 'Terms'; $i++; } - + /* if ($_POST['DayNumber'] > 30 AND empty($_POST['DaysOrFoll'])) { $InputError = 1; prnMsg( _('When the check box is not checked to indicate a day in the following month is the due date') . ', ' . _('the due date cannot be a day after the 30th') . '. ' . _('A number between 1 and 30 is expected') ,'error'); $Errors[$i] = 'DayNumber'; $i++; - } + } */ if ($_POST['DayNumber']>360 AND !empty($_POST['DaysOrFoll'])) { $InputError = 1; prnMsg( _('When the check box is checked to indicate that the term expects a number of days after which accounts are due') . ', ' . _('the number entered should be less than 361 days') ,'error'); @@ -314,4 +314,4 @@ } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> \ No newline at end of file +?> Modified: trunk/PrintCustStatements.php =================================================================== --- trunk/PrintCustStatements.php 2016-06-13 15:30:45 UTC (rev 7555) +++ trunk/PrintCustStatements.php 2016-06-16 11:11:45 UTC (rev 7556) @@ -353,7 +353,7 @@ 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') . ")) >= 0 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate), paymentterms.dayinfollowingmonth)) >= 0 THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END @@ -366,7 +366,7 @@ 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(ADDDATE(last_day(debtortrans.trandate), paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays1'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc ELSE 0 END @@ -379,8 +379,7 @@ 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') . ")) + CASE WHEN (TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(debtortrans.trandate), paymentterms.dayinfollowingmonth)) >= " . $_SESSION['PastDueDays2'] . ") THEN debtortrans.ovamount + debtortrans.ovgst + debtortrans.ovfreight + debtortrans.ovdiscount - debtortrans.alloc Modified: trunk/SupplierInquiry.php =================================================================== --- trunk/SupplierInquiry.php 2016-06-13 15:30:45 UTC (rev 7555) +++ trunk/SupplierInquiry.php 2016-06-16 11:11:45 UTC (rev 7556) @@ -44,21 +44,21 @@ 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 + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= 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'] . "') + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= '" . $_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'] . "') + CASE WHEN TO_DAYS(Now()) - TO_DAYS(ADDDATE(last_day(supptrans.trandate),paymentterms.dayinfollowingmonth)) >= '" . $_SESSION['PastDueDays2'] . "' THEN supptrans.ovamount + supptrans.ovgst - supptrans.alloc ELSE 0 END END ) AS overdue2 FROM suppliers INNER JOIN paymentterms |