From: <dai...@us...> - 2011-08-11 10:08:12
|
Revision: 4656 http://web-erp.svn.sourceforge.net/web-erp/?rev=4656&view=rev Author: daintree Date: 2011-08-11 10:08:05 +0000 (Thu, 11 Aug 2011) Log Message: ----------- 11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. 11/8/11 Phil: PO_Items.php link to complete uncompleted lines - status of order is changed to complete is all lines are completed Modified Paths: -------------- trunk/GoodsReceived.php trunk/PO_Items.php trunk/doc/Change.log trunk/includes/DefinePOClass.php Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/GoodsReceived.php 2011-08-11 10:08:05 UTC (rev 4656) @@ -47,6 +47,11 @@ $RecvQty = 0; } $_SESSION['PO'.$identifier]->LineItems[$Line->LineNo]->ReceiveQty = $RecvQty; + if (isset($_POST['Complete_' . $Line->LineNo])){ + $_SESSION['PO'.$identifier]->LineItems[$Line->LineNo]->Completed = 1; + } else { + $_SESSION['PO'.$identifier]->LineItems[$Line->LineNo]->Completed = 0; + } } } @@ -75,7 +80,7 @@ echo '<table class="selection"> <tr> <td>'. _('Date Goods/Service Received'). ':</td> - <td><input type="text" class=date alt="'. $_SESSION['DefaultDateFormat'] .'" maxlength=10 size=10 onChange="return isDate(this, this.value, '."'". + <td><input type="text" class="date" alt="'. $_SESSION['DefaultDateFormat'] .'" maxlength=10 size=10 onChange="return isDate(this, this.value, '."'". $_SESSION['DefaultDateFormat']."'".')" name="DefaultReceivedDate" value="' . $_POST['DefaultReceivedDate'] . '"></td> </tr> </table> @@ -96,7 +101,8 @@ <th>' . _('Quantity') . '<br />' . _('Ordered') . '</th> <th>' . _('Units') . '</th> <th>' . _('Already') . '<br />' . _('Received') . '</th> - <th>' . _('This Delivery') . '<br />' . _('Quantity') . '</th>'; + <th>' . _('This Delivery') . '<br />' . _('Quantity') . '</th> + <th>' . _('Completed') . '</th>'; if ($_SESSION['ShowValueOnGRN']==1) { echo '<th>' . _('Price') . '</th> @@ -147,23 +153,28 @@ //Now Display LineItem echo '<td>' . $LnItm->StockID . '</td> <td>' . $LnItm->ItemDescription . '</td> - <td class=number>' . $DisplaySupplierQtyOrd . '</td> + <td class="number">' . $DisplaySupplierQtyOrd . '</td> <td>' . $LnItm->SuppliersUnit . '</td> - <td class=number>' . $DisplaySupplierQtyRec . '</td> - <td class=number>' . $LnItm->ConversionFactor . '</td> - <td class=number>' . $DisplayQtyOrd . '</td> + <td class="number">' . $DisplaySupplierQtyRec . '</td> + <td class="number">' . $LnItm->ConversionFactor . '</td> + <td class="number">' . $DisplayQtyOrd . '</td> <td>' . $LnItm->Units . '</td> - <td class=number>' . $DisplayQtyRec . '</td> - <td class=number>'; + <td class="number">' . $DisplayQtyRec . '</td> + <td class="number">'; if ($LnItm->Controlled == 1) { echo '<input type=hidden name="RecvQty_' . $LnItm->LineNo . '" value="' . $LnItm->ReceiveQty . '"><a href="GoodsReceivedControlled.php?identifier=' . $identifier . '&LineNo=' . $LnItm->LineNo . '">' . number_format($LnItm->ReceiveQty,$LnItm->DecimalPlaces) . '</a></td>'; } else { - echo '<input type="text" class=number name="RecvQty_' . $LnItm->LineNo . '" maxlength=10 size=10 value="' . $LnItm->ReceiveQty . '"></td>'; + echo '<input type="text" class="number" name="RecvQty_' . $LnItm->LineNo . '" maxlength=10 size=10 value="' . $LnItm->ReceiveQty . '"></td>'; } - + echo '<td><input type="checkbox" name="Complete_'. $LnItm->LineNo . '"'; + if ($LnItm->Completed ==1){ + echo ' checked'; + } + echo ' /></td>'; + if ($_SESSION['ShowValueOnGRN']==1) { echo '<td class="number">' . $DisplayPrice . '</td>'; echo '<td class="number">' . $DisplayLineTotal . '</td>'; @@ -341,9 +352,11 @@ $PeriodNo = GetPeriod($_POST['DefaultReceivedDate'], $db); $_POST['DefaultReceivedDate'] = FormatDateForSQL($_POST['DefaultReceivedDate']); - + $OrderCompleted = true; //assume all received and completed - now test in case not foreach ($_SESSION['PO'.$identifier]->LineItems as $OrderLine) { - + if ($OrderLine->Completed ==0){ + $OrderCompleted = false; + } if ($OrderLine->ReceiveQty !=0 AND $OrderLine->ReceiveQty!='' AND isset($OrderLine->ReceiveQty)) { $LocalCurrencyPrice = ($OrderLine->Price / $_SESSION['PO'.$identifier]->ExRate); @@ -390,7 +403,7 @@ $SQL = "UPDATE purchorderdetails SET quantityrecd = quantityrecd + '" . $OrderLine->ReceiveQty . "', stdcostunit='" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->StandardCost . "', - completed=0 + completed='" . $_SESSION['PO'.$identifier]->LineItems[$OrderLine->LineNo]->Completed . "' WHERE podetailitem = '" . $OrderLine->PODetailRec . "'"; } @@ -670,10 +683,8 @@ } /*Quantity received is != 0 */ } /*end of OrderLine loop */ - - - if ($_SESSION['PO'.$identifier]->AllLinesReceived()==1) { //all lines on the purchase order are now completed - $StatusComment=date($_SESSION['DefaultDateFormat']) .' - ' . _('Order Completed') .'<br />' . $_SESSION['PO'.$identifier]->StatusComments; + if ($_SESSION['PO'.$identifier]->AllLinesReceived()==1 OR $OrderCompleted) { //all lines on the purchase order are now completed + $StatusComment=date($_SESSION['DefaultDateFormat']) .' - ' . _('Order Completed on entry of GRN') .'<br />' . $_SESSION['PO'.$identifier]->StatusComments; $sql="UPDATE purchorders SET status='Completed', stat_comment='" . $StatusComment . "' Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/PO_Items.php 2011-08-11 10:08:05 UTC (rev 4656) @@ -83,7 +83,8 @@ } else { $UserDetails = ' ' . $_SESSION['UsersRealName'] . ' '; } - if ($_SESSION['AutoAuthorisePO']==1) { //if the user has authority to authorise the PO then it will automatically be authorised + if ($_SESSION['AutoAuthorisePO']==1) { + //if the user has authority to authorise the PO then it will automatically be authorised $AuthSQL ="SELECT authlevel FROM purchorderauth WHERE userid='".$_SESSION['UserID']."' @@ -233,7 +234,23 @@ prnMsg(_('Purchase Order') . ' ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . _('on') . ' ' . $_SESSION['PO'.$identifier]->SupplierName . ' ' . _('has been created'),'success'); } else { /*its an existing order need to update the old order info */ - + /*Check to see if there are any incomplete lines on the order */ + $Completed = true; //assume it is completed i.e. all lines are flagged as completed + foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { + if ($POLine->Completed==0){ + $Completed = false; + break; + } + } + if ($Completed){ + $_SESSION['PO'.$identifier]->Status = 'Completed'; + if (IsEmailAddress($_SESSION['UserEmail'])){ + $UserChangedStatus = ' <a href="mailto:' . $_SESSION['UserEmail'] . '">' . $_SESSION['UsersRealName']. '</a>'; + } else { + $UserChangedStatus = ' ' . $_SESSION['UsersRealName'] . ' '; + } + $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . _('Order completed by') . $UserChangedStatus . '<br />' .$_SESSION['PO'.$identifier]->StatusComments; + } /*Update the purchase order header with any changes */ $sql = "UPDATE purchorders SET supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' , @@ -264,13 +281,14 @@ contact='" . $_SESSION['PO'.$identifier]->Contact . "', paymentterms='" . $_SESSION['PO'.$identifier]->PaymentTerms . "', allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "', - status = '" . $_SESSION['PO'.$identifier]->Status . "' + status = '" . $_SESSION['PO'.$identifier]->Status . "', + stat_comment = '" . $_SESSION['PO'.$identifier]->StatusComments . "' WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('The purchase order could not be updated because'); $DbgMsg = _('The SQL statement used to update the purchase order header record, that failed was'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - + /*Now Update the purchase order detail records */ foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { $result=DB_query($sql,$db,'','',true); @@ -382,6 +400,9 @@ } } +if(isset($_GET['Complete'])){ + $_SESSION['PO'.$identifier]->LineItems[$_GET['Complete']]->Completed=1; +} if (isset($_POST['EnterLine'])){ /*Inputs from the form directly without selecting a stock item from the search */ $AllowUpdate = true; /*always assume the best */ @@ -683,8 +704,13 @@ <td>' . $POLine->SuppliersUnit . '</td> <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' . round(($POLine->Price *$POLine->ConversionFactor),$_SESSION['PO'.$identifier]->CurrDecimalPlaces) .'"></td> <td class="number">' . $DisplayLineTotal . '</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier. '&Delete=' . $POLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td>'; + if ($POLine->QtyReceived !=0 AND $POLine->Completed!=1){ + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier .'&Complete=' . $POLine->LineNo . '">' . _('Complete') . '</a></td>'; + } elseif ($POLine->QtyReceived ==0) { + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier .'&Delete=' . $POLine->LineNo . '">' . _('Delete'). '</a></td>'; + } + echo '</tr>'; $_SESSION['PO'.$identifier]->Total += $LineTotal; } } Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/doc/Change.log 2011-08-11 10:08:05 UTC (rev 4656) @@ -1,5 +1,7 @@ webERP Change Log +11/8/11 Phil: GoodsReceived.php now has checkbox to flag the order line as complete - even though the quantity delivered might be short of the order quantity. +11/8/11 Phil: PO_Items.php link to complete uncompleted lines - status of order is changed to complete is all lines are completed 10/8/11 Phil: POReport.php added link to detail purchase order inquiry 10/8/11 Phil: PO_SelectPurchOrder.php and outstanding purchase order searches now show the delivery date (from the purchase order header) line items may have different delivery dates. 10/8/11 Phil: Stocks.php changing the stock category to one with a different stock account now creates a journal (if stock is linked to GL) to move the cost of the stock from the old GL account to the new GL account Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2011-08-10 10:21:25 UTC (rev 4655) +++ trunk/includes/DefinePOClass.php 2011-08-11 10:08:05 UTC (rev 4656) @@ -93,7 +93,7 @@ $GLCode, $ReqDelDate, $ShiptRef, - 0, + $Completed, $JobRef, $QtyInv, $QtyRecd, @@ -276,7 +276,8 @@ $this->Deleted = false; $this->SerialItems = array(); /*if Controlled then need to populate this later */ $this->SerialItemsValid=false; - $this->AssetID= $AssetID; + $this->AssetID = $AssetID; + } } ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |