[Weberp-svn] SF.net SVN: weberp:[9030] trunk
Brought to you by:
sotandeka,
tim_schofield
From: <tim...@us...> - 2012-06-20 21:28:07
|
Revision: 9030 http://weberp.svn.sourceforge.net/weberp/?rev=9030&view=rev Author: tim_schofield Date: 2012-06-20 21:28:01 +0000 (Wed, 20 Jun 2012) Log Message: ----------- Allow receipts to be marked against an order number Modified Paths: -------------- trunk/CustomerAllocations.php trunk/CustomerReceipt.php trunk/includes/DefineCustAllocsClass.php trunk/includes/DefineReceiptClass.php Modified: trunk/CustomerAllocations.php =================================================================== --- trunk/CustomerAllocations.php 2012-06-20 09:43:43 UTC (rev 9029) +++ trunk/CustomerAllocations.php 2012-06-20 21:28:01 UTC (rev 9030) @@ -253,18 +253,20 @@ // First get transactions that have outstanding balances $SQL = "SELECT debtortrans.id, - typename, - transno, - trandate, - rate, - ovamount+ovgst+ovfreight+ovdiscount as total, - diffonexch, - alloc - FROM debtortrans, systypes - WHERE debtortrans.type = systypes.typeid - AND debtortrans.settled=0 - AND debtorno='" . $_SESSION['Alloc']->DebtorNo . "' - ORDER BY debtortrans.trandate"; + typename, + transno, + trandate, + rate, + order_, + ovamount+ovgst+ovfreight+ovdiscount as total, + diffonexch, + alloc + FROM debtortrans + LEFT JOIN systypes + ON debtortrans.type = systypes.typeid + WHERE debtortrans.settled=0 + AND debtorno='" . $_SESSION['Alloc']->DebtorNo . "' + ORDER BY debtortrans.trandate"; $Result = DB_query($SQL,$db); while ($myrow=DB_fetch_array($Result)) { @@ -276,6 +278,7 @@ 0, $myrow['total'], $myrow['rate'], + $myrow['order_'], $myrow['diffonexch'], $myrow['diffonexch'], $myrow['alloc'], @@ -285,24 +288,25 @@ DB_free_result($Result); // Get trans previously allocated to by this trans - this will overwrite incomplete allocations above - $SQL= "SELECT debtortrans.id, - typename, - transno, - trandate, - rate, - ovamount+ovgst+ovfreight+ovdiscount AS total, - diffonexch, - debtortrans.alloc-custallocns.amt AS prevallocs, - amt, - custallocns.id AS allocid - FROM debtortrans, - systypes, - custallocns - WHERE debtortrans.type = systypes.typeid AND - debtortrans.id=custallocns.transid_allocto AND - custallocns.transid_allocfrom='" . $_POST['AllocTrans'] . "' AND - debtorno='" . $_SESSION['Alloc']->DebtorNo . "' - ORDER BY debtortrans.trandate"; + $SQL = "SELECT debtortrans.id, + typename, + transno, + trandate, + rate, + order_, + ovamount+ovgst+ovfreight+ovdiscount AS total, + diffonexch, + debtortrans.alloc-custallocns.amt AS prevallocs, + amt, + custallocns.id AS allocid + FROM debtortrans + LEFT JOIN systypes + ON debtortrans.type = systypes.typeid + LEFT JOIN custallocns + ON debtortrans.id=custallocns.transid_allocto + WHERE custallocns.transid_allocfrom='" . $_POST['AllocTrans'] . "' + AND debtorno='" . $_SESSION['Alloc']->DebtorNo . "' + ORDER BY debtortrans.trandate"; $Result=DB_query($SQL,$db); while ($myrow=DB_fetch_array($Result)) { @@ -329,15 +333,16 @@ ' ' . _('Allocate Receipts') . '</p>'; $TableHeader = '<tr> - <th>' . _('Trans Type') . '</th> - <th>' . _('Customer') . '</th> - <th>' . _('Cust No') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('To Alloc') . '</th> - <th>' . _('Action') . '</th> - </tr>'; + <th>' . _('Trans Type') . '</th> + <th>' . _('Customer') . '</th> + <th>' . _('Cust No') . '</th> + <th>' . _('Order No') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('To Alloc') . '</th> + <th>' . _('Action') . '</th> + </tr>'; if (isset($_POST['AllocTrans'])) { // Page called with trans number @@ -348,7 +353,7 @@ // Show trans already allocated and potential new allocations echo '<br /><table class="selection">'; - echo '<tr><th colspan="7"><div class="centre"><font color="blue"><b>' . $_SESSION['Alloc']->DebtorNo . ' - ' . $_SESSION['Alloc']->CustomerName . '</b></div>'; + echo '<tr><th colspan="8" class="header">' . $_SESSION['Alloc']->DebtorNo . ' - ' . $_SESSION['Alloc']->CustomerName; if ($_SESSION['Alloc']->TransExRate != 1) { echo '<br />'._('Amount in customer currency').' <b>' . @@ -359,6 +364,7 @@ echo '</th></tr><tr> <th>' . _('Trans') . '<br />' . _('Type') . '</th> <th>' . _('Trans') . '<br />' . _('Number') . '</th> + <th>' . _('Order') . '<br />' . _('Number') . '</th> <th>' . _('Trans') . '<br />' . _('Date') . '</th> <th>' . _('Total') . '<br />' . _('Amount') . '</th> <th>' . _('Yet to') . '<br />' . _('Allocate') . '</th> @@ -386,6 +392,7 @@ echo '<td>' . $AllocnItem->TransType . '</td> <td>' . $AllocnItem->TypeNo . '</td> + <td>' . $AllocnItem->OrderNo . '</td> <td class="number">' . $AllocnItem->TransDate . '</td> <td class="number">' . locale_money_format($AllocnItem->TransAmount,$_SESSION['Alloc']->CurrCode) . '</td> <td class="number">' . locale_money_format($YetToAlloc,$_SESSION['Alloc']->CurrCode) . '</td>'; @@ -414,14 +421,14 @@ } echo '<tr> - <td colspan="5" class="number"><b>'._('Total Allocated').':</b></td> + <td colspan="6" class="number"><b>'._('Total Allocated').':</b></td> <td class="number"><b><u>' . locale_money_format($TotalAllocated,$_SESSION['Alloc']->CurrCode) . '</u></b></td>'; $j++; echo '<td rowspan="2"> <button tabindex='.$j.' type="submit" name="RefreshAllocTotal">' . _('Recalculate Total To Allocate') . '</button></td>'; echo '<tr> - <td colspan="5" class="number"><b>'._('Left to allocate').'</b></td> + <td colspan="6" class="number"><b>'._('Left to allocate').'</b></td> <td class="number"><b>' . locale_money_format($remaining-$TotalAllocated,$_SESSION['Alloc']->CurrCode).'</b></td> </tr>'; echo '</table><br />'; @@ -444,6 +451,7 @@ debtortrans.trandate, debtortrans.reference, debtortrans.rate, + debtortrans.order_, debtortrans.ovamount+debtortrans.ovgst+debtortrans.ovdiscount+debtortrans.ovfreight as total, debtortrans.alloc FROM debtortrans, @@ -476,6 +484,7 @@ echo '<td>' . $myrow['typename'] .'</td> <td>' . $myrow['name'] . '</td> <td>' . $myrow['debtorno'] . '</td> + <td>' . $myrow['order_'] . '</td> <td>' . $myrow['transno'] . '</td> <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td class="number">' . locale_money_format($myrow['total'],$myrow['currcode']) . '</td> @@ -500,6 +509,7 @@ debtortrans.trandate, debtortrans.reference, debtortrans.rate, + debtortrans.order_, debtortrans.ovamount+debtortrans.ovgst+debtortrans.ovdiscount+debtortrans.ovfreight as total, debtortrans.alloc FROM debtortrans, @@ -558,6 +568,7 @@ echo '<td>' . $myrow['typename'] .'</td> <td>' . $myrow['name'] . '</td> <td>' . $myrow['debtorno'] . '</td> + <td>' . $myrow['order_'] . '</td> <td>' . $myrow['transno'] . '</td> <td>' . ConvertSQLDate($myrow['trandate']) . '</td> <td class="number">' . locale_money_format($myrow['total'],$myrow['currcode']) . '</td> Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2012-06-20 09:43:43 UTC (rev 9029) +++ trunk/CustomerReceipt.php 2012-06-20 21:28:01 UTC (rev 9030) @@ -155,6 +155,9 @@ if (!isset($_POST['CustomerName'])) { $_POST['CustomerName']=''; } + if (!isset($_POST['OrderNumber'])) { + $_POST['OrderNumber']=''; + } if ($_POST['GLCode'] == '' and $_GET['Type']=='GL') { prnMsg( _('No General Ledger code has been chosen') . ' - ' . _('so this GL analysis item could not be added'),'warn'); @@ -163,6 +166,7 @@ $_POST['CustomerID'], filter_currency_input($_POST['Discount']), $_POST['Narrative'], + $_POST['OrderNumber'], $_POST['GLCode'], $_POST['PayeeBankDetail'], $_POST['CustomerName'], @@ -183,7 +187,6 @@ unset($_POST['PayeeBankDetail']); } - if (isset($_POST['CommitBatch'])){ /* once all receipts items entered, process all the data in the @@ -380,6 +383,7 @@ prd, reference, tpe, + order_, rate, ovamount, ovdiscount, @@ -394,6 +398,7 @@ '" . $PeriodNo . "', '" . $_SESSION['ReceiptBatch']->ReceiptType . ' ' . $ReceiptItem->PayeeBankDetail . "', '', + '" . $ReceiptItem->OrderNo . "', '" . filter_currency_input($_SESSION['ReceiptBatch']->ExRate/$_SESSION['ReceiptBatch']->FunctionalExRate) . "', -" . ($ReceiptItem->Amount) . ", -" . filter_currency_input($ReceiptItem->Discount) . ", @@ -530,7 +535,7 @@ '<a href="' . $rootpath . '/PDFBankingSummary.php?BatchNo=' . $_SESSION['ReceiptBatch']->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">• ' . $rootpath . '/CustomerReceipt.php?NewReceipt=Yes&Type=Customer ' . _('Enter Receipts') . ' </p>'; + echo '<p class="page_title_text">•<a href="' . $rootpath . '/CustomerReceipt.php?NewReceipt=Yes&Type=Customer">' . _('Enter Receipts') . '</a></p>'; unset($_SESSION['ReceiptBatch']); include('includes/footer.inc'); exit; @@ -833,6 +838,11 @@ if (!isset($_SESSION['ReceiptBatch']->Narrative)) { $_SESSION['ReceiptBatch']->Narrative=''; } + +if (!isset($_POST['Currency'])) { + $_POST['Currency']=$_SESSION['CompanyRecord']['currencydefault']; +} + echo '<tr> <td>' . _('Narrative') . ':</td><td><input tabindex="7" type="text" name="BatchNarrative" maxlength="50" size="52" value="' . $_SESSION['ReceiptBatch']->Narrative . '" /></td> </tr> @@ -1017,6 +1027,20 @@ echo '<input tabindex="11" type="hidden" name="Discount" value="0" />'; } + $sql="SELECT orderno + FROM salesorders + WHERE debtorno='" . $_POST['CustomerID'] . "'"; + $OrderResult=DB_query($sql, $db); + + echo '<tr> + <td>' . _('Order no. (If advanced payment against order)') . '</td> + <td><select name="OrderNumber">'; + echo '<option value=""></option>'; + while ($OrderRow=DB_fetch_array($OrderResult)) { + echo '<option value="' . $OrderRow['orderno'] . '">' . $OrderRow['orderno'] . '</option>'; + } + echo '</td></tr>'; + echo '<tr><td>' . _('Payee Bank Details') . ':</td> <td><input tabindex="12" type="text" name="PayeeBankDetail" maxlength="22" size="20" value="' . $_POST['PayeeBankDetail'] . '" /></td></tr>'; // echo '<tr><td>' . _('Narrative') . ':</td> Modified: trunk/includes/DefineCustAllocsClass.php =================================================================== --- trunk/includes/DefineCustAllocsClass.php 2012-06-20 09:43:43 UTC (rev 9029) +++ trunk/includes/DefineCustAllocsClass.php 2012-06-20 21:28:01 UTC (rev 9030) @@ -23,10 +23,10 @@ $this->Allocs = array(); } - function add_to_AllocsAllocn ($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID){ + function add_to_AllocsAllocn ($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $OrderNo, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID){ // if ($AllocAmt <= ($TransAmount - $PrevAlloc)){ - $this->Allocs[$ID] = new Allocn($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID); + $this->Allocs[$ID] = new Allocn($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $OrderNo, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID); Return 1; } @@ -48,6 +48,7 @@ Var $AllocAmt; Var $TransAmount; Var $ExRate; + Var $OrderNo; Var $DiffOnExch; /*Difference on exchange calculated on this allocation */ Var $PrevDiffOnExch; /*Difference on exchange before this allocation */ Var $PrevAlloc; /*Total of allocations vs this trans from other receipts/credits*/ @@ -57,7 +58,7 @@ THERE CAN BE ONLY ONE ... allocation record for each receipt/inovice combination */ - function Allocn ($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID){ + function Allocn ($ID, $TransType, $TypeNo, $TransDate, $AllocAmt, $TransAmount, $ExRate, $OrderNo, $DiffOnExch, $PrevDiffOnExch, $PrevAlloc, $PrevAllocRecordID){ /* Constructor function to add a new Allocn object with passed params */ $this->ID =$ID; @@ -68,6 +69,7 @@ $this->OrigAlloc = $AllocAmt; $this->TransAmount = $TransAmount; $this->ExRate = $ExRate; + $this->OrderNo = $OrderNo; $this->DiffOnExch=$DiffOnExch; $this->PrevDiffOnExch = $PrevDiffOnExch; $this->PrevAlloc = $PrevAlloc; Modified: trunk/includes/DefineReceiptClass.php =================================================================== --- trunk/includes/DefineReceiptClass.php 2012-06-20 09:43:43 UTC (rev 9029) +++ trunk/includes/DefineReceiptClass.php 2012-06-20 21:28:01 UTC (rev 9030) @@ -26,9 +26,9 @@ $this->total=0; } - function add_to_batch($Amount, $Customer, $Discount, $Narrative, $GLCode, $PayeeBankDetail, $CustomerName, $tag){ + function add_to_batch($Amount, $Customer, $Discount, $Narrative, $OrderNo, $GLCode, $PayeeBankDetail, $CustomerName, $tag){ if ((isset($Customer) or isset($GLCode)) and ($Amount + $Discount) !=0){ - $this->Items[$this->ItemCounter] = new Receipt($Amount, $Customer, $Discount, $Narrative, $this->ItemCounter, $GLCode, $PayeeBankDetail, $CustomerName, $tag); + $this->Items[$this->ItemCounter] = new Receipt($Amount, $Customer, $Discount, $Narrative, $OrderNo, $this->ItemCounter, $GLCode, $PayeeBankDetail, $CustomerName, $tag); $this->ItemCounter++; $this->total = $this->total + ($Amount + $Discount) / $this->ExRate; Return 1; @@ -51,12 +51,13 @@ Var $CustomerName; Var $Discount; Var $Narrative; + Var $OrderNo; Var $GLCode; Var $PayeeBankDetail; Var $ID; var $tag; - function Receipt ($Amt, $Cust, $Disc, $Narr, $id, $GLCode, $PayeeBankDetail, $CustomerName, $tag){ + function Receipt ($Amt, $Cust, $Disc, $Narr, $OrderNo, $id, $GLCode, $PayeeBankDetail, $CustomerName, $tag){ /* Constructor function to add a new Receipt object with passed params */ $this->Amount =$Amt; @@ -64,6 +65,7 @@ $this->CustomerName = $CustomerName; $this->Discount = $Disc; $this->Narrative = $Narr; + $this->OrderNo = $OrderNo; $this->GLCode = $GLCode; $this->PayeeBankDetail=$PayeeBankDetail; $this->ID = $id; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |