From: <dai...@us...> - 2010-05-29 00:00:48
|
Revision: 3475 http://web-erp.svn.sourceforge.net/web-erp/?rev=3475&view=rev Author: daintree Date: 2010-05-29 00:00:42 +0000 (Sat, 29 May 2010) Log Message: ----------- New field in locations table to allow a default cash sales account to be setup by location -modifications to Locations.php to allow it to be entered and error-trapping for debtor - branch format required for specification. This will be used in a new CounterSales.php script I am working on Modified Paths: -------------- trunk/Locations.php trunk/PricesByCost.php trunk/SelectOrderItems.php trunk/doc/Change.log.html trunk/sql/mysql/upgrade3.11.1-3.12.sql Modified: trunk/Locations.php =================================================================== --- trunk/Locations.php 2010-05-28 18:22:16 UTC (rev 3474) +++ trunk/Locations.php 2010-05-29 00:00:42 UTC (rev 3475) @@ -30,6 +30,24 @@ $InputError = 1; prnMsg( _('The location code may not be empty'), 'error'); } + if ($_POST['CashSaleCustomer']!=''){ + if (!strstr($_POST['CashSaleCustomer'],' - ')){ + $InputError =1; + prnMsg(_('The cash sale customer account must be a valid customer account separated by " - " then the branch code of the customer entered'), 'error'); + } else { + $Branch = substr($_POST['CashSaleCustomer'],strpos($_POST['CashSaleCustomer'],' - ')+3); + $DebtorNo = substr($_POST['CashSaleCustomer'],0,strpos($_POST['CashSaleCustomer'],' - ')); + $sql = "SELECT * FROM custbranch WHERE debtorno='" . $DebtorNo . "' + AND branchcode='" . $Branch . "'"; + + $result = DB_query($sql,$db); + if (DB_num_rows($result)==0){ + $InputError = 1; + prnMsg(_('The cash sale customer for this location must be a valid customer code separated by " - " then a valid branch code for this customer'),'error'); + } + } + } //end of checking the customer - branch code entered + if (isset($SelectedLocation) AND $InputError !=1) { @@ -54,6 +72,7 @@ email='" . $_POST['Email'] . "', contact='" . $_POST['Contact'] . "', taxprovinceid = " . $_POST['TaxProvince'] . ", + cashsalecustomer ='" . $_POST['CashSaleCustomer'] . "', managed = " . $_POST['Managed'] . " WHERE loccode = '$SelectedLocation'"; @@ -76,6 +95,7 @@ unset($_POST['Email']); unset($_POST['TaxProvince']); unset($_POST['Managed']); + unset($_POST['CashSaleCustomer']); unset($SelectedLocation); unset($_POST['Contact']); @@ -105,6 +125,7 @@ email, contact, taxprovinceid, + cashsalecustomer, managed ) VALUES ( @@ -121,6 +142,7 @@ '" . $_POST['Email'] . "', '" . $_POST['Contact'] . "', " . $_POST['TaxProvince'] . ", + '" . $_POST['CashSaleCustomer'] . "', " . $_POST['Managed'] . " )"; @@ -160,6 +182,7 @@ unset($_POST['Fax']); unset($_POST['Email']); unset($_POST['TaxProvince']); + unset($_POST['CashSaleCustomer']); unset($_POST['Managed']); unset($SelectedLocation); unset($_POST['Contact']); @@ -402,6 +425,7 @@ tel, email, taxprovinceid, + cashsalecustomer, managed FROM locations WHERE loccode='$SelectedLocation'"; @@ -422,6 +446,7 @@ $_POST['Fax'] = $myrow['fax']; $_POST['Email'] = $myrow['email']; $_POST['TaxProvince'] = $myrow['taxprovinceid']; + $_POST['CashSaleCustomer'] = $myrow['cashsalecustomer']; $_POST['Managed'] = $myrow['managed']; @@ -468,6 +493,9 @@ if (!isset($_POST['Email'])) { $_POST['Email'] = ''; } + if (!isset($_POST['CashSaleCustomer'])) { + $_POST['CashSaleCustomer'] = ''; + } if (!isset($_POST['Managed'])) { $_POST['Managed'] = 0; } @@ -510,8 +538,15 @@ ?> </select></td></tr> + <tr><td><?php echo _('Default Counter Sales Customer') . ':'; ?></td> + <td><input type="Text" name="CashSaleCustomer" value="<?php echo $_POST['CashSaleCustomer']; ?>" size=25 maxlength=23></td></tr> + <?php + /* + This functionality is not written yet ... <tr><td><?php echo _('Enable Warehouse Management') . ':'; ?></td> <td><input type='checkbox' name='Managed'<?php if($_POST['Managed'] == 1) echo ' checked';?>></td></tr> + */ + ?> </table> <div class="centre"><input type="Submit" name="submit" value="<?php echo _('Enter Information'); ?>"></div> Modified: trunk/PricesByCost.php =================================================================== --- trunk/PricesByCost.php 2010-05-28 18:22:16 UTC (rev 3474) +++ trunk/PricesByCost.php 2010-05-29 00:00:42 UTC (rev 3475) @@ -91,9 +91,9 @@ <th>' . _('Start Date') . '</th> <th>' . _('End Date') . '</th> <th>' . _('Cost') . '</th> - <th>' . _('Current Margin') . '</th> + <th>' . _('GP %') . '</th> <th>' . _('Price Proposed') . '</th> - <th>' . _('Price in pricelist') . '</th> + <th>' . _('List Price') . '</th> <tr>'; $k = 0; //row colour counter echo '<form action="' .$_SERVER['PHP_SELF'] .'" method="POST" name="update">'; @@ -127,10 +127,10 @@ <input type="hidden" value=' . $myrow['startdate'] . ' name="StartDate_' . $PriceCounter .'"> <input type="hidden" value=' . $myrow['enddate'] . ' name="EndDate_' . $PriceCounter .'">'; //variable for current margin - if ($Cost != 0){ - $CurrentMargin = $Price / $Cost; + if ($myrow['price'] != 0){ + $CurrentGP = ($myrow['price']-$Cost)*100 / $myrow['price']; } else { - $CurrentMargin = 0; + $CurrentGP = 0; } //variable for proposed $Proposed = $Cost * $_POST['Margin']; @@ -146,9 +146,9 @@ <td>' . ConvertSQLDate($myrow['startdate']) . '</td> <td>' . $EndDateDisplay . '</td> <td class="number">' . number_format($Cost, 2) . '</td> - <td class="number">' . number_format($CurrentMargin, 2) . '</td> + <td class="number">' . number_format($CurrentGP, 1) . '%</td> <td class="number">' . number_format($Proposed, 2) . '</td> - <td><input type="text" class="number" name="Price_' . $PriceCounter . '" MAXLENGTH =14 size=15 value="' . $myrow['price'] . '"></td> + <td><input type="text" class="number" name="Price_' . $PriceCounter . '" maxlength=14 size=10 value="' . $myrow['price'] . '"></td> </tr> '; $PriceCounter++; } //end of looping Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2010-05-28 18:22:16 UTC (rev 3474) +++ trunk/SelectOrderItems.php 2010-05-29 00:00:42 UTC (rev 3475) @@ -62,9 +62,6 @@ } -// removed to improve UI layout -//echo '<a href="'. $rootpath . '/SelectSalesOrder.php?' . SID . '">'. _('Back to Sales Orders'). '</a><br>'; - if (isset($_GET['ModifyOrderNumber']) AND $_GET['ModifyOrderNumber']!=''){ Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-05-28 18:22:16 UTC (rev 3474) +++ trunk/doc/Change.log.html 2010-05-29 00:00:42 UTC (rev 3475) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>28/5/10 Phil: New field in locations table to allow a default cash sales account to be setup by location -modifications to Locations.php to allow it to be entered and error-trapping for debtor - branch format required for specification. This will be used in a new CounterSales.php script I am working on <P>27/05/10 Tim: PurchData.php - Show the uom name, not the number</p> <P>27/05/10 Tim: CustomerAllocations.php - Show the right balance, and the allocate link where needed</p> <P>27/05/10 Tim: GoodsReceived.php - Correctly show the suppliers Units of measure</p> @@ -8,7 +9,7 @@ <P>26/05/10 Tim: Corrections to Suppliers.php and new fields for suppliers table</p> <P>26/05/10 Tim: Corrections to SelectCustomer.php and Customers.php</p> <P>24/05/10 Simon Peter Otandeka: Added telephone, email and fax fields to Suppliers and Customers Pages. Ability to add/edit the records.</p> -<P>16/05/10 Phil: javascripts/MiscFunctions.js - not my field ... but could not resist adding some indentation - I struggle at the best of times with javascript but this was a shocker to read!! Hope I didnt mess up anything</p> +<P>16/05/10 Phil: javascripts/MiscFunctions.js - not my field ... but could not resist adding some indentation - I struggle at the best of times with javascript but this was a shocker to read!! Hope I didn't mess up anything</p> <P>16/05/10 Phil: reworked PDFRemittanceAdvices.php - somehow missed from tcpdf work to print utf-8 pdfs</p> <p>16/05/10 Phil: reworked PDFPriceList to use the new effective dates fields and print out effective prices as at a specified date - showing effective dates on the report - also ditched includes/PDFPriceListPageHeader.php in favour of a PageHeader() function inside PDFPriceList.php. Also made the script work with tcpdf - not sure how it was missed before?</p> <p>16/05/10 Phil: reworked PricesBasedOnMarkUp.php to insert new prices with effectivity dates and update the prices where effectivity dates specified.</p> Modified: trunk/sql/mysql/upgrade3.11.1-3.12.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-3.12.sql 2010-05-28 18:22:16 UTC (rev 3474) +++ trunk/sql/mysql/upgrade3.11.1-3.12.sql 2010-05-29 00:00:42 UTC (rev 3475) @@ -157,9 +157,9 @@ ALTER TABLE prices DROP PRIMARY KEY , ADD PRIMARY KEY ( `stockid` , `typeabbrev` , `currabrev` , `debtorno` , `startdate` , `enddate` ) ; -UPDATE prices SET startdate='1999-01-01', enddate='9999-12-31'; +UPDATE prices SET startdate='1999-01-01', enddate=''; ALTER TABLE stockcheckfreeze ADD COLUMN stockcheckdate date NOT NULL; -UPDATE prices SET startdate='1999-01-01'; ALTER TABLE suppliers add (email varchar(55),fax varchar(25), telephone varchar(25)); +ALTER TABLE locations add cashsalecustomer VARCHAR(21) NOT NULL DEFAULT ''; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |