From: <ice...@us...> - 2012-06-25 13:27:14
|
Revision: 5459 http://web-erp.svn.sourceforge.net/web-erp/?rev=5459&view=rev Author: icedlava Date: 2012-06-25 13:27:02 +0000 (Mon, 25 Jun 2012) Log Message: ----------- Add a few bookmarks for webERP manual. Modified Paths: -------------- trunk/CustomerBranches.php trunk/Customers.php trunk/Stocks.php trunk/SupplierContacts.php trunk/SupplierInvoice.php trunk/Suppliers.php trunk/doc/Manual/ManualAccountsPayable.html trunk/doc/Manual/ManualAccountsReceivable.html Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2012-06-24 14:39:40 UTC (rev 5458) +++ trunk/CustomerBranches.php 2012-06-25 13:27:02 UTC (rev 5459) @@ -4,8 +4,10 @@ include('includes/session.inc'); $title = _('Customer Branches'); +/* webERP manual links before header.inc */ +$ViewTopic= 'AccountsReceivable'; +$BookMark = 'NewCustomerBranch'; include('includes/header.inc'); - if (isset($_GET['DebtorNo'])) { $DebtorNo = mb_strtoupper($_GET['DebtorNo']); } else if (isset($_POST['DebtorNo'])){ @@ -112,7 +114,7 @@ // Format: Longitude, Latitude, Altitude $Latitude = $coordinatesSplit[1]; $Longitude = $coordinatesSplit[0]; - + $status = $xml->Response->Status->code; if (strcmp($status, '200') == 0) { // Successful geocode @@ -417,11 +419,11 @@ $DebtorNo, urlencode($myrow[1]), _('Delete Branch')); - - if ($myrow[11]){ - $TotalDisable++; - }else { - $TotalEnable++; + + if ($myrow[11]){ + $TotalDisable++; + }else { + $TotalEnable++; } } while ($myrow = DB_fetch_row($result)); @@ -536,7 +538,7 @@ echo '<input type="hidden" name="SelectedBranch" value="' . $SelectedBranch . '" />'; echo '<input type="hidden" name="BranchCode" value="' . $_POST['BranchCode'] . '" />'; - + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" /> ' . ' ' . _('Change Details for Branch'). ' '. $SelectedBranch . '</p>'; if (isset($SelectedBranch)) { @@ -673,9 +675,9 @@ //SQL to poulate account selection boxes - $sql = "SELECT salesmanname, - salesmancode - FROM salesman + $sql = "SELECT salesmanname, + salesmancode + FROM salesman WHERE current = 1"; $result = DB_query($sql,$db); @@ -799,7 +801,7 @@ echo '<tr> <td>'._('Tax Group').':</td> <td><select tabindex="19" name="TaxGroup">'; - + while ($myrow = DB_fetch_array($TaxGroupResults)) { if (isset($_POST['TaxGroup']) and $myrow['taxgroupid']==$_POST['TaxGroup']) { echo '<option selected="selected" value="'; @@ -825,7 +827,7 @@ echo ' </select></td></tr>'; - + $SQL = "SELECT shipper_id, shippername FROM shippers"; $ShipperResults = DB_query($SQL,$db); if (DB_num_rows($ShipperResults)==0){ @@ -862,7 +864,7 @@ echo '<option selected="selected" value="1">' . _('Show company details and logo') . '</option> <option value="2">' . _('Hide company details and logo') . '</option>'; } - + echo '</select></td> </tr>'; Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2012-06-24 14:39:40 UTC (rev 5458) +++ trunk/Customers.php 2012-06-25 13:27:02 UTC (rev 5459) @@ -5,7 +5,9 @@ include('includes/session.inc'); $title = _('Customer Maintenance'); - +/* webERP manual links before header.inc */ +$ViewTopic= 'AccountsReceivable'; +$BookMark = 'NewCustomer'; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -500,7 +502,7 @@ $DateString = Date($_SESSION['DefaultDateFormat']); echo '<tr><td>' . _('Customer Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> <td><input tabindex="10" type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ClientSince" value="' . $DateString . '" size="12" maxlength="10" /></td></tr>'; - + echo '</table></td> <td><table class="selection"> <tr> @@ -611,7 +613,7 @@ <div class="centre"> <input tabindex="20" type="submit" name="submit" value="' . _('Add New Customer') . '" /> <input tabindex="21" type="submit" value="' . _('Reset') . '" /> </div>'; - + } echo '</div>'; echo '</form>'; @@ -650,7 +652,7 @@ typeid FROM debtorsmaster WHERE debtorsmaster.debtorno = '" . $DebtorNo . "'"; - + $ErrMsg = _('The customer details could not be retrieved because'); $result = DB_query($sql,$db,$ErrMsg); @@ -675,9 +677,9 @@ $_POST['ClientSince'] = ConvertSQLDate($myrow['clientsince']); $_POST['HoldReason'] = $myrow['holdreason']; $_POST['PaymentTerms'] = $myrow['paymentterms']; - $_POST['Discount'] = locale_number_format($myrow['discount'] * 100,2); + $_POST['Discount'] = locale_number_format($myrow['discount'] * 100,2); $_POST['DiscountCode'] = $myrow['discountcode']; - $_POST['PymtDiscount'] = locale_number_format($myrow['pymtdiscount'] * 100,2); + $_POST['PymtDiscount'] = locale_number_format($myrow['pymtdiscount'] * 100,2); $_POST['CreditLimit'] = locale_number_format($myrow['creditlimit'],0); $_POST['InvAddrBranch'] = $myrow['invaddrbranch']; $_POST['TaxRef'] = $myrow['taxref']; @@ -759,7 +761,7 @@ <td>' . _('Address Line 6') . ':</td> <td><input ' . (in_array('Address6',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Address6" size="42" maxlength="40" value="' . $_POST['Address6'] . '" /></td> </tr>'; - + } // Select sales types for drop down list if (isset($_GET['Modify'])) { @@ -808,10 +810,10 @@ echo '</select></td></tr> <tr><td>' . _('Customer Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> <td>' . $_POST['ClientSince'] . '</td></tr>'; - + echo '</table></td> <td><table class="selection">'; - + echo '<tr> <td>' . _('Discount Percent') . ':</td> <td>' . $_POST['Discount'] . '</td> @@ -841,7 +843,7 @@ </tr> </table></td> <td><table class="selection">'; - + echo '<tr> <td>' . _('Discount Percent') . ':</td> <td><input type="text" name="Discount" class="number" size="5" maxlength="4" value="' . $_POST['Discount'] . '" /></td> @@ -995,7 +997,7 @@ if (isset($_GET['delete'])) { //User hit delete link on customer contacts /*Process this first before showing remaining contacts */ - $resultupcc = DB_query("DELETE FROM custcontacts + $resultupcc = DB_query("DELETE FROM custcontacts WHERE debtorno='".$DebtorNo."' AND contid='".$ID."'", $db); @@ -1008,9 +1010,9 @@ role, phoneno, notes, - email - FROM custcontacts - WHERE debtorno='".$DebtorNo."' + email + FROM custcontacts + WHERE debtorno='".$DebtorNo."' ORDER BY contid"; $result = DB_query($sql,$db); @@ -1081,7 +1083,7 @@ } }//END WHILE LIST LOOP echo '</table>'; - + echo'</td></tr></table>'; if (isset($_POST['New']) and $_POST['New']) { @@ -1096,7 +1098,7 @@ <input type="submit" name="delete" value="' . _('Delete Customer') . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');" /> </div>'; } - + echo '</div> </form>'; } // end of main ifs Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2012-06-24 14:39:40 UTC (rev 5458) +++ trunk/Stocks.php 2012-06-25 13:27:02 UTC (rev 5459) @@ -4,7 +4,6 @@ include('includes/session.inc'); $title = _('Item Maintenance'); -$title = _('Item Maintenance'); /* webERP manual links before header.inc */ $ViewTopic= 'Inventory'; $BookMark = 'InventoryAddingItems'; Modified: trunk/SupplierContacts.php =================================================================== --- trunk/SupplierContacts.php 2012-06-24 14:39:40 UTC (rev 5458) +++ trunk/SupplierContacts.php 2012-06-25 13:27:02 UTC (rev 5459) @@ -4,7 +4,9 @@ include('includes/session.inc'); $title = _('Supplier Contacts'); - +/* webERP manual links before header.inc */ +$ViewTopic= 'AccountsPayable'; +$BookMark = 'SupplierContact'; include('includes/header.inc'); if (isset($_GET['SupplierID'])){ @@ -64,7 +66,7 @@ fax='" . $_POST['Fax'] . "', email='" . $_POST['Email'] . "', mobile = '". $_POST['Mobile'] . "' - WHERE contact='".$SelectedContact."' + WHERE contact='".$SelectedContact."' AND supplierid='".$SupplierID."'"; $msg = _('The supplier contact information has been updated'); @@ -136,16 +138,16 @@ AND suppliercontacts.supplierid = '".$SupplierID."'"; $result = DB_query($sql, $db); - + if (DB_num_rows($result)>0){ - + $myrow = DB_fetch_array($result); - + echo '<table class="selection"> <tr> <th colspan="7"><h3>' . _('Contacts Defined for') . ' - ' . $myrow['suppname'] . '</h3></th> </tr>'; - + echo '<tr> <th>' . _('Name') . '</th> <th>' . _('Position') . '</th> @@ -153,7 +155,7 @@ <th>' . _('Fax No') . '</th> <th>' . _('Email') . '</th> </tr>'; - + do { printf('<tr><td>%s</td> <td>%s</td> @@ -210,7 +212,7 @@ FROM suppliercontacts WHERE contact='" . $SelectedContact . "' AND supplierid='" . $SupplierID . "'"; - + $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2012-06-24 14:39:40 UTC (rev 5458) +++ trunk/SupplierInvoice.php 2012-06-25 13:27:02 UTC (rev 5459) @@ -12,7 +12,9 @@ include('includes/session.inc'); $title = _('Enter Supplier Invoice'); - +/* webERP manual links before header.inc */ +$ViewTopic= 'AccountsPayable'; +$BookMark = 'SupplierInvoice'; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -182,7 +184,7 @@ if (!isset($_POST['PostInvoice'])){ - if (isset($_POST['GRNS']) + if (isset($_POST['GRNS']) AND $_POST['GRNS'] == _('Purchase Orders')){ /*This ensures that any changes in the page are stored in the session before calling the grn page */ echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/SuppInvGRNs.php">'; @@ -217,7 +219,7 @@ <br />'; exit; } - if (isset($_POST['FixedAssets']) + if (isset($_POST['FixedAssets']) AND $_POST['FixedAssets'] == _('Fixed Assets')){ /*This ensures that any changes in the page are stored in the session before calling the shipments page */ echo '<meta http-equiv="refresh" content="0; url=' . $rootpath . '/SuppFixedAssetChgs.php">'; @@ -268,8 +270,8 @@ echo '<br /> <div class="centre"> - <input type="submit" name="GRNS" value="' . _('Purchase Orders') . '" /> - <input type="submit" name="Shipts" value="' . _('Shipments') . '" /> + <input type="submit" name="GRNS" value="' . _('Purchase Orders') . '" /> + <input type="submit" name="Shipts" value="' . _('Shipments') . '" /> <input type="submit" name="Contracts" value="' . _('Contracts') . '" /> '; if ( $_SESSION['SuppTrans']->GLLink_Creditors == 1){ @@ -279,7 +281,7 @@ </div>'; $TotalGRNValue = 0; - + if (count( $_SESSION['SuppTrans']->GRNs)>0){ /*if there are any GRNs selected for invoicing then */ /*Show all the selected GRNs so far from the SESSION['SuppInv']->GRNs array */ @@ -334,9 +336,9 @@ <th>' . _('Amount') . '</th> </tr>'; echo $TableHeader; - + $i=0; //row counter - + foreach ($_SESSION['SuppTrans']->Shipts as $EnteredShiptRef){ echo '<tr> @@ -416,7 +418,7 @@ </tr>'; echo $TableHeader; - + $i=0; foreach ($_SESSION['SuppTrans']->Contracts as $Contract){ @@ -443,7 +445,7 @@ } $TotalGLValue = 0; - + if ( $_SESSION['SuppTrans']->GLLink_Creditors == 1){ if (count($_SESSION['SuppTrans']->GLCodes) > 0){ @@ -526,7 +528,7 @@ /*If a tax rate is entered that is not the same as it was previously then recalculate automatically the tax amounts */ - if (!isset($_POST['OverRideTax']) + if (!isset($_POST['OverRideTax']) OR $_POST['OverRideTax']=='Auto'){ echo ' <input type="text" class="number" name="TaxRate' . $Tax->TaxCalculationOrder . '" maxlength="4" size="4" value="' . locale_number_format($_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100,$_SESSION['SuppTrans']->CurrDecimalPlaces) . '" />%'; @@ -619,43 +621,43 @@ $InputError = False; if ( $TaxTotal + $_SESSION['SuppTrans']->OvAmount < 0){ - + $InputError = True; prnMsg(_('The invoice as entered cannot be processed because the total amount of the invoice is less than 0') . '. ' . _('Invoices are expected to have a positive charge'),'error'); echo '<p>' . _('The tax total is') . ' : ' . locale_number_format($TaxTotal,$_SESSION['SuppTrans']->CurrDecimalPlaces); echo '<p>' . _('The ovamount is') . ' : ' . locale_number_format($_SESSION['SuppTrans']->OvAmount,$_SESSION['SuppTrans']->CurrDecimalPlaces); - + } elseif ( $TaxTotal + $_SESSION['SuppTrans']->OvAmount == 0){ - + prnMsg(_('The invoice as entered will be processed but be warned the amount of the invoice is zero!') . '. ' . _('Invoices are normally expected to have a positive charge'),'warn'); - + } elseif (mb_strlen( $_SESSION['SuppTrans']->SuppReference)<1){ - + $InputError = True; prnMsg(_('The invoice as entered cannot be processed because the there is no suppliers invoice number or reference entered') . '. ' . _('The supplier invoice number must be entered'),'error'); } elseif (!Is_date( $_SESSION['SuppTrans']->TranDate)){ - + $InputError = True; prnMsg( _('The invoice as entered cannot be processed because the invoice date entered is not in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); } elseif (DateDiff(Date($_SESSION['DefaultDateFormat']), $_SESSION['SuppTrans']->TranDate, 'd') < 0){ - + $InputError = True; prnMsg(_('The invoice as entered cannot be processed because the invoice date is after today') . '. ' . _('Purchase invoices are expected to have a date prior to or today'),'error'); }elseif ( $_SESSION['SuppTrans']->ExRate <= 0){ - + $InputError = True; prnMsg( _('The invoice as entered cannot be processed because the exchange rate for the invoice has been entered as a negative or zero number') . '. ' . _('The exchange rate is expected to show how many of the suppliers currency there are in 1 of the local currency'),'error'); - + } elseif ( $_SESSION['SuppTrans']->OvAmount < round($_SESSION['SuppTrans']->Total_Shipts_Value() + $_SESSION['SuppTrans']->Total_GL_Value() + $_SESSION['SuppTrans']->Total_Contracts_Value()+ $_SESSION['SuppTrans']->Total_Assets_Value()+$_SESSION['SuppTrans']->Total_GRN_Value(),$_SESSION['SuppTrans']->CurrDecimalPlaces)){ - + prnMsg( _('The invoice total as entered is less than the sum of the shipment charges, the general ledger entries (if any), the charges for goods received, contract charges and fixed asset charges. There must be a mistake somewhere, the invoice as entered will not be processed'),'error'); $InputError = True; } else { - + $sql = "SELECT count(*) FROM supptrans WHERE supplierno='" . $_SESSION['SuppTrans']->SupplierID . "' @@ -782,7 +784,7 @@ account, narrative, amount) - VALUES ('20', + VALUES ('20', '" . $InvoiceNo . "', '" . $SQLInvoiceDate . "', '" . $PeriodNo . "', @@ -814,7 +816,7 @@ account, narrative, amount) - VALUES ('20', + VALUES ('20', '" . $InvoiceNo . "', '" . $SQLInvoiceDate . "', '" . $PeriodNo . "', @@ -829,7 +831,7 @@ foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN){ - if (mb_strlen($EnteredGRN->ShiptRef) == 0 + if (mb_strlen($EnteredGRN->ShiptRef) == 0 OR $EnteredGRN->ShiptRef == 0){ /*so its not a GRN shipment item enter the GL entry to reverse the GRN suspense entry created on delivery @@ -845,7 +847,7 @@ account, narrative, amount) - VALUES ('20', + VALUES ('20', '" . $InvoiceNo . "', '" . $SQLInvoiceDate . "', '" . $PeriodNo . "', @@ -870,7 +872,7 @@ /*need to get the stock category record for this stock item - this is function in SQL_CommonFunctions.inc */ $StockGLCode = GetStockGLCode($EnteredGRN->ItemCode,$db); - + /*We have stock item and a purchase price variance need to see whether we are using Standard or WeightedAverageCosting */ if ($_SESSION['WeightedAverageCosting']==1){ /*Weighted Average costing */ @@ -900,11 +902,11 @@ if ($EnteredGRN->This_QuantityInv > $TotalQuantityOnHand){ /*So we need to write off some of the variance to variances and only the balance of the quantity in stock to go to stock value */ - + /*if the TotalQuantityOnHand is negative then this variance to write off is inflated by the negative quantity - which makes sense */ - + $WriteOffToVariances = ($EnteredGRN->This_QuantityInv - $TotalQuantityOnHand) * (($EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate) - $EnteredGRN->StdCostUnit); - + $SQL = "INSERT INTO gltrans (type, typeno, trandate, @@ -926,7 +928,7 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); } // end if the quantity being invoiced here is greater than the current stock on hand - + /*Now post any remaining price variance to stock rather than price variances */ $SQL = "INSERT INTO gltrans (type, @@ -1093,7 +1095,7 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction for the control total could not be added because'); $DbgMsg = _('The following SQL to insert the GL transaction was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); - + EnsureGLEntriesBalance(20, $InvoiceNo, $db); } /*Thats the end of the GL postings */ @@ -1147,12 +1149,12 @@ /* Now update the GRN and PurchOrderDetails records for amounts invoiced - can't use the other loop through the GRNs as this was only where the GL link to credtors is active */ foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN){ - + //in local currency - $ActualCost = $EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate; + $ActualCost = $EnteredGRN->ChgPrice / $_SESSION['SuppTrans']->ExRate; $PurchPriceVar = $EnteredGRN->This_QuantityInv * ($ActualCost - $EnteredGRN->StdCostUnit); - - $SQL = "UPDATE purchorderdetails + + $SQL = "UPDATE purchorderdetails SET qtyinvoiced = qtyinvoiced + " . $EnteredGRN->This_QuantityInv .", actprice = '" . $EnteredGRN->ChgPrice . "' WHERE podetailitem = '" . $EnteredGRN->PODetailItem . "'"; @@ -1163,8 +1165,8 @@ $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, True); - $SQL = "UPDATE grns - SET quantityinv = quantityinv + " . $EnteredGRN->This_QuantityInv . " + $SQL = "UPDATE grns + SET quantityinv = quantityinv + " . $EnteredGRN->This_QuantityInv . " WHERE grnno = '" . $EnteredGRN->GRNNo . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The quantity invoiced off the goods received record could not be updated because'); @@ -1193,35 +1195,35 @@ } //end of adding GRN shipment charges else { /*so its not a GRN shipment item its a plain old stock item */ - + if ($PurchPriceVar !=0){ /* don't bother with any of this lot if there is no difference ! */ - + if (mb_strlen($EnteredGRN->ItemCode)>0 OR $EnteredGRN->ItemCode != ''){ /*so it is a stock item */ - /*We need to: + /*We need to: * * a) update the stockmove for the delivery to reflect the actual cost of the delivery * * b) If a WeightedAverageCosting system and the stock quantity on hand now is negative then the cost that has gone to sales analysis and the cost of sales stock movement records will have been incorrect ... attempt to fix it retrospectively */ /*Get the location that the stock was booked into */ - $result = DB_query("SELECT intostocklocation - FROM purchorders + $result = DB_query("SELECT intostocklocation + FROM purchorders WHERE orderno='" . $EnteredGRN->PONo . "'", $db); $LocRow = DB_fetch_array($result); $LocCode = $LocRow['intostocklocation']; - + /* First update the stockmoves delivery cost */ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The stock movement record for the delivery could not have the cost updated to the actual cost'); - $SQL = "UPDATE stockmoves SET price = '" . $ActualCost . "' - WHERE stockid='" .$EnteredGRN->ItemCode . "' + $SQL = "UPDATE stockmoves SET price = '" . $ActualCost . "' + WHERE stockid='" .$EnteredGRN->ItemCode . "' AND type=25 - AND loccode='" . $LocCode . "' + AND loccode='" . $LocCode . "' AND transno='" . $EnteredGRN->GRNBatchNo . "'"; - + $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,True); - + if ($_SESSION['WeightedAverageCosting']==1){ /* * How many in stock now? @@ -1230,9 +1232,9 @@ * here then some items sold will not have had this cost factored in * The cost of these items = $ActualCost */ - - $sql ="SELECT quantity - FROM locstock + + $sql ="SELECT quantity + FROM locstock WHERE loccode='" . $LocCode . "' AND stockid='" . $EnteredGRN->ItemCode . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The quantity on hand could not be retrieved from the database'); @@ -1240,23 +1242,23 @@ $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg); $QtyRow = DB_fetch_row($Result); $TotalQuantityOnHand = $QtyRow[0]; - + /* If the quantity on hand is less the quantity charged on this invoice then some must have been sold and the price variance should be reflected in the cost of sales*/ - + if ($EnteredGRN->This_QuantityInv > $TotalQuantityOnHand){ - - /* The variance to the extent of the quantity invoiced should also be written off against the sales analysis cost - as sales analysis would have been created using the cost at the time the sale was made... this was incorrect as hind-sight has shown here. However, how to determine when these were last sold? To update the sales analysis cost. Work through the last 6 months sales analysis from the latest period in which this invoice is being posted and prior. - + + /* The variance to the extent of the quantity invoiced should also be written off against the sales analysis cost - as sales analysis would have been created using the cost at the time the sale was made... this was incorrect as hind-sight has shown here. However, how to determine when these were last sold? To update the sales analysis cost. Work through the last 6 months sales analysis from the latest period in which this invoice is being posted and prior. + The assumption here is that the goods have been sold prior to the purchase invoice being entered so it is necessary to back track on the sales analysis cost. * Note that this will mean that posting to GL COGS will not agree to the cost of sales from the sales analysis * Of course the price variances will need to be included in COGS as well * */ - + $QuantityVarianceAllocated = $EnteredGRN->This_QuantityInv; $CostVarPerUnit = $ActualCost - $EnteredGRN->StdCostUnit; $PeriodAllocated = $PeriodNo; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sales analysis records could not be updated for the cost variances on this purchase invoice'); - + while ($QuantityVarianceAllocated >0) { $SalesAnalResult=DB_query("SELECT cust, custbranch, @@ -1301,9 +1303,9 @@ break; } } /*end loop around different periods to see which sales analysis records to update */ - + /*now we need to work back through the sales stockmoves up to the quantity on this purchase invoice to update costs - * Only go back up to 6 months looking for stockmoves and + * Only go back up to 6 months looking for stockmoves and * Only in the stock location where the purchase order was received * into - if the stock was transferred to another location then * we cannot adjust for this */ @@ -1311,7 +1313,7 @@ type, qty, standardcost - FROM stockmoves + FROM stockmoves WHERE loccode='" . $LocCode . "' AND qty < 0 AND stockid='" . $EnteredGRN->ItemCode . "' @@ -1330,9 +1332,9 @@ } } else { //Only $QuantityVarianceAllocated left to allocate so need need to apportion cost using weighted average if ($StkMoveRow['type']==10) { //its a sales invoice - + $WACost = (((-$StkMoveRow['qty']- $QuantityVarianceAllocated)*$StkMoveRow['standardcost'])+($QuantityVarianceAllocated*$ActualCost))/-$StkMoveRow['qty']; - + $UpdStkMovesResult = DB_query("UPDATE stockmoves SET standardcost = '" . $WACost . "' WHERE stkmoveno = '" . $StkMoveRow['stkmoveno'] . "'", @@ -1344,27 +1346,27 @@ } // end if the quantity being invoiced here is greater than the current stock on hand /*Now to update the stock cost with the new weighted average */ - + /*Need to consider what to do if the cost has been changed manually between receiving the stock and entering the invoice - this code assumes there has been no cost updates made manually and all the price variance is posted to stock. - + A nicety or important?? */ - - + + $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The cost could not be updated because'); $DbgMsg = _('The following SQL to update the cost was used'); - + if ($TotalQuantityOnHand>0) { - + $CostIncrement = ($PurchPriceVar - $WriteOffToVariances) / $TotalQuantityOnHand; - - $sql = "UPDATE stockmaster + + $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost, - materialcost=materialcost+" . $CostIncrement . " + materialcost=materialcost+" . $CostIncrement . " WHERE stockid='" . $EnteredGRN->ItemCode . "'"; $Result = DB_query($sql, $db, $ErrMsg, $DbgMsg, True); - } else { + } else { /* if stock is negative then update the cost to this cost */ - $sql = "UPDATE stockmaster + $sql = "UPDATE stockmaster SET lastcost=materialcost+overheadcost+labourcost, materialcost='" . $ActualCost . "' WHERE stockid='" . $EnteredGRN->ItemCode . "'"; @@ -1397,11 +1399,11 @@ $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE The fixed asset transaction could not be inserted because'); $DbgMsg = _('The following SQL to insert the fixed asset transaction record was used'); $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); - + /*Now update the asset cost in fixedassets table */ - $SQL = "UPDATE fixedassets SET cost = cost + " . ($PurchPriceVar) . " + $SQL = "UPDATE fixedassets SET cost = cost + " . ($PurchPriceVar) . " WHERE assetid = '" . $EnteredGRN->AssetID . "'"; - + $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE. The fixed asset cost could not be updated because:'); $DbgMsg = _('The following SQL was used to attempt the update of the asset cost:'); $Result = DB_query($SQL,$db,$ErrMsg, $DbgMsg, true); Modified: trunk/Suppliers.php =================================================================== --- trunk/Suppliers.php 2012-06-24 14:39:40 UTC (rev 5458) +++ trunk/Suppliers.php 2012-06-25 13:27:02 UTC (rev 5459) @@ -5,7 +5,9 @@ include('includes/session.inc'); $title = _('Supplier Maintenance'); - +/* webERP manual links before header.inc */ +$ViewTopic= 'AccountsPayable'; +$BookMark = 'NewSupplier'; include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); @@ -324,10 +326,10 @@ $Errors[$i] = 'ID'; $i++; } - if (mb_strlen($_POST['SuppName']) > 40 - OR mb_strlen($_POST['SuppName']) == 0 + if (mb_strlen($_POST['SuppName']) > 40 + OR mb_strlen($_POST['SuppName']) == 0 OR $_POST['SuppName'] == '') { - + $InputError = 1; prnMsg(_('The supplier name must be entered and be forty characters or less long'),'error'); $Errors[$i]='Name'; Modified: trunk/doc/Manual/ManualAccountsPayable.html =================================================================== --- trunk/doc/Manual/ManualAccountsPayable.html 2012-06-24 14:39:40 UTC (rev 5458) +++ trunk/doc/Manual/ManualAccountsPayable.html 2012-06-25 13:27:02 UTC (rev 5459) @@ -23,7 +23,7 @@ <!-- Help Begin: Suppliers --> <div class="floatright"><a class="minitext" href="#top">⬆ Top</a></div> -<h2>Entering Supplier (Vendors)</h2> +<h2><a id="NewSupplier">Entering Supplier (Vendors)</a></h2> <p> From the menu Payables tab, under Maintenance, click on "Add A New Supplier". The new details entered are only committed to the database as a new supplier once the user clicks on the button to "Insert New Supplier". If the user moves to another screen without clicking this button any entries are lost.</p> <h3>Supplier Code</h3> @@ -89,7 +89,7 @@ <!-- Help End: SelectSupplier --> <!-- Help Begin: SupplierContacts --> <div class="floatright"><a class="minitext" href="#top">⬆ Top</a></div> -<h2>Supplier Contacts</h2> +<h2><a id="SupplierContact">Supplier Contacts</a></h2> <p> Any number of supplier contacts can be defined. This facility allows for ready access to phone numbers and email addresses of all company suppliers. Purchase orders created can be emailed directly to any of the defined contacts email addresses.</p> <p> @@ -113,7 +113,7 @@ <!-- Help End: SupplierContacts --> <!-- Help Begin: SupplierInvoices --> <div class="floatright"><a class="minitext" href="#top">⬆ Top</a></div> - <h2>Entering Supplier Invoices</h2> + <h2><a id="SupplierInvoice">Entering Supplier Invoices</a></h2> <p> As with all transactions in webERP the entity to be transacted with must first be selected i.e. a customer, item or supplier. Entering accounts payable transactions then requires the selection of a supplier first. Once a supplier is selected, the menu of options shows for the supplier among them "Enter an Invoice". The process below applies equally to entry of supplier credit notes as it does to entry of purchase invoices. In every case, entry of invoices and supplier credit notes (debit notes) requires entry of: Modified: trunk/doc/Manual/ManualAccountsReceivable.html =================================================================== --- trunk/doc/Manual/ManualAccountsReceivable.html 2012-06-24 14:39:40 UTC (rev 5458) +++ trunk/doc/Manual/ManualAccountsReceivable.html 2012-06-25 13:27:02 UTC (rev 5459) @@ -26,7 +26,7 @@ <a class="minitext" href="#top">⬆ Top</a> </div> -<h2>Entering New Customers</h2> +<h2><a id="NewCustomer">Entering New Customers</a></h2> <p>From the menu Receivables tab, click on "Add A New Customer". The customer record is the actual charge account, any number of branches can be defined for each customer account. At least one branch must be defined for each customer. It is the branch details that record the local information about delivery address, tax authority, sales area and sales person.</p> @@ -94,8 +94,9 @@ <div class="floatright"> <a class="minitext" href="#top">⬆ Top</a> </div> -<h2>Entering Customer Branches</h2> +<h2><a id="NewCustomerBranch">Entering Customer Branches</a></h2> + <p>A customer code entered on its own is insufficient to enter sales orders against. All customers must have at least one branch. The branch records contain the information about the delivery address, the sales area, the tax code, the sales representative and other regional information. New branches can be set up at any time. The first step will always be to select the customer, then to Add/Edit/Delete Customer Branch Records from the Customer menu. There is no limit to the number of branches that can be referenced against a single charge account (customer record). However, branches cannot be transferred between different customers. Only one statement will print per customer, but each invoice will be referenced to the branch it was delivered to.</p> <h3>Branch Name</h3> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |