From: <dai...@us...> - 2013-07-21 10:55:02
|
Revision: 6122 http://sourceforge.net/p/web-erp/reponame/6122 Author: daintree Date: 2013-07-21 10:54:58 +0000 (Sun, 21 Jul 2013) Log Message: ----------- Phil: Set default tax cat at stock category level Modified Paths: -------------- trunk/BOMInquiry.php trunk/SelectProduct.php trunk/StockCategories.php trunk/Stocks.php trunk/sql/mysql/upgrade4.10-4.11.sql Modified: trunk/BOMInquiry.php =================================================================== --- trunk/BOMInquiry.php 2013-07-21 10:20:02 UTC (rev 6121) +++ trunk/BOMInquiry.php 2013-07-21 10:54:58 UTC (rev 6122) @@ -173,9 +173,10 @@ FROM bom INNER JOIN stockmaster ON bom.component = stockmaster.stockid WHERE bom.parent = '" . $StockID . "' - AND bom.effectiveafter < Now() - AND bom.effectiveto > Now()"; - + AND bom.effectiveafter < '" . Date('Y-m-d') . "' + AND (bom.effectiveto > '" . Date('Y-m-d') . "' + OR bom.effectiveto='0000-00-00')"; + $ErrMsg = _('The bill of material could not be retrieved because'); $BOMResult = DB_query ($sql,$db,$ErrMsg); Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2013-07-21 10:20:02 UTC (rev 6121) +++ trunk/SelectProduct.php 2013-07-21 10:54:58 UTC (rev 6122) @@ -182,9 +182,10 @@ FROM bom INNER JOIN stockmaster ON bom.component=stockmaster.stockid - WHERE bom.parent='" . $StockID . "' - AND bom.effectiveto > '" . Date('Y-m-d') . "' - AND bom.effectiveafter < '" . Date('Y-m-d') . "'", $db); + WHERE bom.parent = '" . $StockID . "' + AND bom.effectiveafter < '" . Date('Y-m-d') . "' + AND (bom.effectiveto > '" . Date('Y-m-d') . "' + OR bom.effectiveto='0000-00-00')";", $db); $CostRow = DB_fetch_row($CostResult); $Cost = $CostRow[0]; } else { Modified: trunk/StockCategories.php =================================================================== --- trunk/StockCategories.php 2013-07-21 10:20:02 UTC (rev 6121) +++ trunk/StockCategories.php 2013-07-21 10:54:58 UTC (rev 6122) @@ -72,6 +72,7 @@ $sql = "UPDATE stockcategory SET stocktype = '" . $_POST['StockType'] . "', categorydescription = '" . $_POST['CategoryDescription'] . "', + defaulttaxcatid = '" . $_POST['DefaultTaxCatID'] . "', stockact = " . $_POST['StockAct'] . ", adjglact = " . $_POST['AdjGLAct'] . ", issueglact = " . $_POST['IssueGLAct'] . ", @@ -142,6 +143,7 @@ $sql = "INSERT INTO stockcategory (categoryid, stocktype, categorydescription, + defaulttaxcatid, stockact, adjglact, issueglact, @@ -152,6 +154,7 @@ '" . $_POST['CategoryID'] . "', '" . $_POST['StockType'] . "', '" . $_POST['CategoryDescription'] . "', + '" . $_POST['DefaultTaxCatID'] . "', '" . $_POST['StockAct'] . "', '" . $_POST['AdjGLAct'] . "', '" . $_POST['IssueGLAct'] . "', @@ -307,7 +310,8 @@ issueglact, purchpricevaract, materialuseagevarac, - wipact + wipact, + defaulttaxcatid FROM stockcategory WHERE categoryid='" . $SelectedCategory . "'"; @@ -323,6 +327,7 @@ $_POST['PurchPriceVarAct'] = $myrow['purchpricevaract']; $_POST['MaterialUseageVarAc'] = $myrow['materialuseagevarac']; $_POST['WIPAct'] = $myrow['wipact']; + $_POST['DefaultTaxCatID'] = $myrow['defaulttaxcatid']; } echo '<input type="hidden" name="SelectedCategory" value="' . $SelectedCategory . '" />'; echo '<input type="hidden" name="CategoryID" value="' . $_POST['CategoryID'] . '" />'; @@ -339,7 +344,7 @@ echo '<table class="selection"> <tr> <td>' . _('Category Code') . ':</td> - <td><input type="text" name="CategoryID" size="7" maxlength="6" value="' . $_POST['CategoryID'] . '" /></td> + <td><input type="text" name="CategoryID" required="required" autofocus="autofocus" pattern="[0-9a-zA-Z_]*{1,6}" title="' . _('Enter up to six alphanumeric characters or underscore as a code for this stock category') . '" size="7" maxlength="6" value="' . $_POST['CategoryID'] . '" /></td> </tr>'; } @@ -370,7 +375,7 @@ echo '<tr> <td>' . _('Category Description') . ':</td> - <td><input type="text" name="CategoryDescription" size="22" maxlength="20" value="' . $_POST['CategoryDescription'] . '" /></td> + <td><input type="text" name="CategoryDescription" required="required" title="' . _('A description of the inventory category is required') . '" size="22" maxlength="20" value="' . $_POST['CategoryDescription'] . '" /></td> </tr>'; @@ -401,6 +406,27 @@ echo '</select></td> </tr>'; +echo '<tr> + <td>' . _('Default Tax Category') . ':</td> + <td><select name="DefaultTaxCatID">'; +$sql = "SELECT taxcatid, taxcatname FROM taxcategories ORDER BY taxcatname"; +$result = DB_query($sql, $db); + +if (!isset($_POST['DefaultTaxCatID'])){ + $_POST['DefaultTaxCatID'] = $_SESSION['DefaultTaxCategory']; +} + +while ($myrow = DB_fetch_array($result)) { + if ($_POST['DefaultTaxCatID'] == $myrow['taxcatid']){ + echo '<option selected="selected" value="' . $myrow['taxcatid'] . '">' . $myrow['taxcatname'] . '</option>'; + } else { + echo '<option value="' . $myrow['taxcatid'] . '">' . $myrow['taxcatname'] . '</option>'; + } +} //end while loop + +echo '</select></td> + </tr>'; + echo '<tr><td><input type="submit" name="UpdateTypes" style="visibility:hidden;width:1px" value="Not Seen" />'; if (isset($_POST['StockType']) and $_POST['StockType']=='L') { $Result = $PnLAccountsResult; Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2013-07-21 10:20:02 UTC (rev 6121) +++ trunk/Stocks.php 2013-07-21 10:54:58 UTC (rev 6122) @@ -566,7 +566,9 @@ WHERE stockid='" . $StockID ."'",$db); if (DB_num_rows($result)==1){ prnMsg(_('The stock code entered is actually already in the database - duplicate stock codes are prohibited by the system. Try choosing an alternative stock code'),'error'); - exit; + InputError = 1; + $Errors[$i] = 'StockID'; + $i++; } else { $sql = "INSERT INTO stockmaster (stockid, description, @@ -844,7 +846,7 @@ } -echo '<form id="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; +echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">'; echo '<div>'; if (isset($StockID)){ echo '<table width="100%"> @@ -867,7 +869,7 @@ if ($New==1) { echo '<tr> <td>'. _('Item Code'). ':</td> - <td><input ' . (in_array('StockID',$Errors) ? 'class="inputerror"' : '' ) .' type="text" value="'.$StockID.'" name="StockID" size="21" maxlength="20" /></td> + <td><input ' . (in_array('StockID',$Errors) ? 'class="inputerror"' : '' ) .' autofocus="autofocus" required="required" pattern="[0-9a-zA-Z_]*{1,20}" type="text" value="'.$StockID.'" name="StockID" size="20" maxlength="20" /></td> </tr>'; } else { echo '<tr> @@ -955,7 +957,7 @@ } echo '<tr> <td>' . _('Part Description') . ' (' . _('short') . '):</td> - <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="Description" size="52" maxlength="50" value="' . stripslashes($Description) . '" /></td> + <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="text" ' . ($New==0?'autofocus="autofocus"':'') . ' name="Description" required="required" size="52" maxlength="50" value="' . stripslashes($Description) . '" /></td> </tr>'; foreach ($ItemDescriptionLanguages as $DescriptionLanguage) { Modified: trunk/sql/mysql/upgrade4.10-4.11.sql =================================================================== --- trunk/sql/mysql/upgrade4.10-4.11.sql 2013-07-21 10:20:02 UTC (rev 6121) +++ trunk/sql/mysql/upgrade4.10-4.11.sql 2013-07-21 10:54:58 UTC (rev 6122) @@ -180,6 +180,7 @@ INSERT INTO config VALUES ('ShopShowTopCategoryMenu','1'); INSERT INTO config VALUES ('ShopShowLogoAndShopName','1'); +ALTER TABLE `stockcategory` ADD `defaulttaxcatid` TINYINT NOT NULL DEFAULT '1' ALTER TABLE `salescat` ADD `active` INT NOT NULL DEFAULT '1' COMMENT '1 if active 0 if inactive'; INSERT INTO config VALUES ('ShopManagerEmail',''); |