This list is closed, nobody may subscribe to it.
2011 |
Jan
(14) |
Feb
(42) |
Mar
(56) |
Apr
(60) |
May
(54) |
Jun
(48) |
Jul
(74) |
Aug
(52) |
Sep
(68) |
Oct
(64) |
Nov
(42) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2012 |
Jan
(142) |
Feb
(270) |
Mar
(374) |
Apr
(230) |
May
(214) |
Jun
(116) |
Jul
(234) |
Aug
(66) |
Sep
(120) |
Oct
(16) |
Nov
(17) |
Dec
(41) |
2013 |
Jan
(19) |
Feb
(18) |
Mar
(8) |
Apr
(40) |
May
(121) |
Jun
(42) |
Jul
(127) |
Aug
(145) |
Sep
(27) |
Oct
(38) |
Nov
(83) |
Dec
(61) |
2014 |
Jan
(33) |
Feb
(35) |
Mar
(59) |
Apr
(41) |
May
(38) |
Jun
(45) |
Jul
(17) |
Aug
(58) |
Sep
(46) |
Oct
(51) |
Nov
(55) |
Dec
(36) |
2015 |
Jan
(57) |
Feb
(67) |
Mar
(70) |
Apr
(34) |
May
(32) |
Jun
(11) |
Jul
(3) |
Aug
(17) |
Sep
(16) |
Oct
(13) |
Nov
(30) |
Dec
(30) |
2016 |
Jan
(17) |
Feb
(12) |
Mar
(17) |
Apr
(20) |
May
(47) |
Jun
(15) |
Jul
(13) |
Aug
(30) |
Sep
(32) |
Oct
(20) |
Nov
(32) |
Dec
(24) |
2017 |
Jan
(16) |
Feb
|
Mar
(11) |
Apr
(11) |
May
(5) |
Jun
(42) |
Jul
(9) |
Aug
(10) |
Sep
(14) |
Oct
(15) |
Nov
(2) |
Dec
(29) |
2018 |
Jan
(28) |
Feb
(49) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <dai...@us...> - 2011-05-25 10:30:55
|
Revision: 4574 http://web-erp.svn.sourceforge.net/web-erp/?rev=4574&view=rev Author: daintree Date: 2011-05-25 10:30:45 +0000 (Wed, 25 May 2011) Log Message: ----------- new sales inquiries Modified Paths: -------------- trunk/COGSGLPostings.php trunk/PeriodsInquiry.php trunk/SalesGLPostings.php trunk/UpgradeDatabase.php trunk/build/make_release.sh trunk/config.distrib.php trunk/doc/Change.log trunk/doc/Manual/ManualContents.php trunk/index.php trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.mo trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po trunk/locale/de_DE.utf8/LC_MESSAGES/messages.mo trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po trunk/locale/el_GR.utf8/LC_MESSAGES/messages.mo trunk/locale/el_GR.utf8/LC_MESSAGES/messages.po trunk/locale/en_GB.utf8/LC_MESSAGES/messages.pot trunk/locale/en_US.utf8/LC_MESSAGES/messages.mo trunk/locale/en_US.utf8/LC_MESSAGES/messages.po trunk/locale/es_ES.utf8/LC_MESSAGES/messages.mo trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po trunk/locale/et_EE.utf8/LC_MESSAGES/messages.mo trunk/locale/et_EE.utf8/LC_MESSAGES/messages.po trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.mo trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.po trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.mo trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.po trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.mo trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.po trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.mo trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.po trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.mo trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.po trunk/locale/id_ID.utf8/LC_MESSAGES/messages.mo trunk/locale/id_ID.utf8/LC_MESSAGES/messages.po trunk/locale/it_IT.utf8/LC_MESSAGES/messages.mo trunk/locale/it_IT.utf8/LC_MESSAGES/messages.po trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.mo trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.po trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.mo trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.po trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.mo trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.po trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.mo trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.po trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.po trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.po trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.mo trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.po trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.mo trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.po trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.mo trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.po trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.mo trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.po trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.mo trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.po trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.mo trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.po trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.mo trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.po trunk/sql/mysql/upgrade4.03-4.04.sql trunk/sql/mysql/weberp-demo.sql trunk/sql/mysql/weberp-new.sql Added Paths: ----------- trunk/SalesByTypePeriodInquiry.php trunk/SalesCategoryPeriodInquiry.php trunk/SalesTopItemsInquiry.php Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/COGSGLPostings.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -84,7 +84,7 @@ if (DB_num_rows($result)>0){ $ShowLivePostingRecords = false; prnMsg (_('The following cost of sales posting records that do not have valid general ledger code specified - these records must be amended.'),'error'); - echo '<table class=selection>'; + echo '<table class="selection">'; echo '<tr><th>' . _('Area') . '</th> <th>' . _('Stock Category') . '</th> <th>' . _('Sales Type') . '</th> @@ -209,7 +209,7 @@ <td>%s</td> <td>%s</td> <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">' . _('Delete') . '</td> + <td><a href="%sSelectedCOGSPostingID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this COGS GL posting record?') . '\');">' . _('Delete') . '</td> </tr>', $myrow['area'], $myrow['stkcat'], Modified: trunk/PeriodsInquiry.php =================================================================== --- trunk/PeriodsInquiry.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/PeriodsInquiry.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -1,10 +1,7 @@ <?php /* $Id$*/ -/* $Revision: 1.8 $ */ -//$PageSecurity = 2; - include ('includes/session.inc'); $title = _('Periods Inquiry'); @@ -13,13 +10,13 @@ $SQL = "SELECT periodno , lastdate_in_period - FROM periods - ORDER BY periodno"; + FROM periods + ORDER BY periodno"; $ErrMsg = _('No periods were returned by the SQL because'); $PeriodsResult = DB_query($SQL,$db,$ErrMsg); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; /*show a table of the orders returned by the SQL */ @@ -28,16 +25,18 @@ $PeriodsInTable = round($NumberOfPeriods/3,0); $TableHeader = '<tr><th>' . _('Period Number') . '</th> - <th>' . _('Date of Last Day') . '</th> - </tr>'; + <th>' . _('Date of Last Day') . '</th> + </tr>'; + echo '<table><tr>'; -for ($i=0;$i<2;$i++) { - echo '<td>'; - echo '<table cellpadding=2 colspan=2 class=selection>'; + +for ($i=0;$i<3;$i++) { + echo '<td valign="top">'; + echo '<table cellpadding=2 colspan=2 class="selection">'; echo $TableHeader; $k=0; - for ($j=0; $j<$PeriodsInTable;$j++) { - $myrow=DB_fetch_array($PeriodsResult); + $j=0; + while ($myrow=DB_fetch_array($PeriodsResult)){ if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -45,33 +44,18 @@ echo '<tr class="OddTableRows">'; $k++; } - $FormatedLastDate = ConvertSQLDate($myrow['lastdate_in_period']); - echo "<td>".$myrow['periodno']."</td> - <td>".$FormatedLastDate."</td> - </tr>"; + echo '<td>' . $myrow['periodno'] . '</td> + <td>' . ConvertSQLDate($myrow['lastdate_in_period']) . '</td> + </tr>'; + $j++; + if ($j==$PeriodsInTable){ + break; + } } echo '</table>'; echo '</td>'; } -echo '<td>'; -echo '<table cellpadding=2 colspan=2 class=selection>'; -echo $TableHeader; -$k = 0; //row colour counter -while ($myrow=DB_fetch_array($PeriodsResult)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k++; - } - $FormatedLastDate = ConvertSQLDate($myrow['lastdate_in_period']); - echo "<td>".$myrow['periodno']."</td> - <td>".$FormatedLastDate."</td> - </tr>"; -} -echo '</table>'; -echo '</td>'; + echo '</tr></table>'; //end of while loop Added: trunk/SalesByTypePeriodInquiry.php =================================================================== --- trunk/SalesByTypePeriodInquiry.php (rev 0) +++ trunk/SalesByTypePeriodInquiry.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -0,0 +1,560 @@ +<?php + +/* $Id: SalesByTypePeriodInquiry.php 4261 2010-12-22 15:56:50Z tim_schofield $*/ + +include('includes/session.inc'); +$title = _('Sales Report'); +include('includes/header.inc'); +include('includes/DefineCartClass.php'); + +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Report') . '</p>'; +echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br>'; + +if (!isset($_POST['DisplayData'])){ + /* then assume to display daily - maybe wrong to do this but hey better than reporting an error?*/ + $_POST['DisplayData']='Weekly'; +} +if (!isset($_POST['DateRange'])){ + /* then assume report is for This Month - maybe wrong to do this but hey better than reporting an error?*/ + $_POST['DateRange']='ThisMonth'; +} + +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +echo '<table cellpadding=2 class="selection"> + <tr><td valign=top> + <table>'; + +echo '<tr><th colspan="2" class="centre">' . _('Date Selection') . '</th> + </tr> + <tr> + <td>' . _('Custom Range') . ':</td> + <td><input type="radio" name="DateRange" value="Custom" '; +if ($_POST['DateRange']=='Custom'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Week') . ':</td> + <td><input type="radio" name="DateRange" value="ThisWeek" '; +if ($_POST['DateRange']=='ThisWeek'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Month') . ':</td> + <td><input type="radio" name="DateRange" value="ThisMonth" '; +if ($_POST['DateRange']=='ThisMonth'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Quarter') . ':</td> + <td><input type="radio" name="DateRange" value="ThisQuarter" '; +if ($_POST['DateRange']=='ThisQuarter'){ + echo 'checked'; +} +echo '></td> + </tr>'; +if ($_POST['DateRange']=='Custom'){ + echo '<tr> + <td>' . _('Date From') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Date To') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> + </tr>'; +} +echo '</table> + </td><td valign=top> + <table>'; + +echo '<tr><th colspan="2" class="centre">' . _('Display Data') . '</th> + </tr> + <tr> + <td>' . _('Daily') . ':</td> + <td><input type="radio" name="DisplayData" value="Daily" '; +if ($_POST['DisplayData']=='Daily'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('Weekly') . ':</td> + <td><input type="radio" name="DisplayData" value="Weekly" '; +if ($_POST['DisplayData']=='Weekly'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('Monthly') . ':</td> + <td><input type="radio" name="DisplayData" value="Monthly" '; +if ($_POST['DisplayData']=='Monthly'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('Quarterly') . ':</td> + <td><input type="radio" name="DisplayData" value="Quarterly" '; +if ($_POST['DisplayData']=='Monthly'){ + echo 'checked'; +} +echo '></td> + </tr>'; +echo '</table> + </td></tr> + </table>'; + + +echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '">'; +echo '</form></div>'; +echo '<br />'; + +if ($_POST['DateRange']=='Custom' AND !isset($_POST['FromDate']) AND !isset($_POST['ToDate'])){ + //Don't run the report until custom dates entered + unset($_POST['ShowSales']); +} + +if (isset($_POST['ShowSales'])){ + $InputError=0; //assume no input errors now test for errors + if ($_POST['DateRange']=='Custom'){ + if (!Is_Date($_POST['FromDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the from date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (!Is_Date($_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the to date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (Date1GreaterThanDate2($_POST['FromDate'],$_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The from date is expected to be a date prior to the to date. Please review the selected date range'),'error'); + } + } + switch ($_POST['DateRange']) { + case 'ThisWeek': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w')+1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisMonth': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisQuarter': + switch (date('m')) { + case 1: + case 2: + case 3: + $QuarterStartMonth=1; + break; + case 4: + case 5: + case 6: + $QuarterStartMonth=4; + break; + case 7: + case 8: + case 9: + $QuarterStartMonth=7; + break; + default: + $QuarterStartMonth=10; + } + $FromDate = date('Y-m-d',mktime(0,0,0,$QuarterStartMonth,1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'Custom': + $FromDate = FormatDateForSQL($_POST['FromDate']); + $ToDate = FormatDateForSQL($_POST['ToDate']); + } + switch ($_POST['DisplayData']) { + case 'Daily': + $sql = "SELECT debtortrans.trandate, + debtortrans.tpe, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) + as salesvalue, + SUM(CASE WHEN stockmoves.type=10 THEN + 1 ELSE 0 END) + as nooforders, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) + as returnvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves + INNER JOIN custbranch + ON stockmoves.debtorno=custbranch.debtorno + AND stockmoves.branchcode=custbranch.branchcode + INNER JOIN debtortrans + ON stockmoves.type=debtortrans.type + AND stockmoves.transno=debtortrans.transno + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND debtortrans.trandate>='" . $FromDate . "' + AND debtortrans.trandate<='" . $ToDate . "' + GROUP BY debtortrans.trandate, + tpe + ORDER BY debtortrans.trandate, + tpe"; + + break; + case 'Weekly': + $sql = "SELECT WEEKOFYEAR(debtortrans.trandate) as week_no, + YEAR(debtortrans.trandate) as transyear, + debtortrans.tpe, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) + as salesvalue, + SUM(CASE WHEN stockmoves.type=10 THEN + 1 ELSE 0 END) + as nooforders, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) + as returnvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves + INNER JOIN custbranch + ON stockmoves.debtorno=custbranch.debtorno + AND stockmoves.branchcode=custbranch.branchcode + INNER JOIN debtortrans + ON stockmoves.type=debtortrans.type + AND stockmoves.transno=debtortrans.transno + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND debtortrans.trandate>='" . $FromDate . "' + AND debtortrans.trandate<='" . $ToDate . "' + GROUP BY week_no, + transyear, + tpe + ORDER BY transyear, + week_no, + tpe"; + + break; + case 'Monthly': + $sql = "SELECT MONTH(debtortrans.trandate) as month_no, + MONTHNAME(debtortrans.trandate) as month_name, + YEAR(debtortrans.trandate) as transyear, + debtortrans.tpe, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) + as salesvalue, + SUM(CASE WHEN stockmoves.type=10 THEN + 1 ELSE 0 END) + as nooforders, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) + as returnvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves + INNER JOIN custbranch + ON stockmoves.debtorno=custbranch.debtorno + AND stockmoves.branchcode=custbranch.branchcode + INNER JOIN debtortrans + ON stockmoves.type=debtortrans.type + AND stockmoves.transno=debtortrans.transno + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND debtortrans.trandate>='" . $FromDate . "' + AND debtortrans.trandate<='" . $ToDate . "' + GROUP BY month_no, + month_name, + transyear, + debtortrans.tpe + ORDER BY transyear, + month_no, + tpe"; + + break; + case 'Quarterly': + $sql = "SELECT QUARTER(debtortrans.trandate) as quarter_no, + YEAR(debtortrans.trandate) as transyear, + debtortrans.tpe, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) + as salesvalue, + SUM(CASE WHEN stockmoves.type=10 THEN + 1 ELSE 0 END) + as nooforders, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) + as returnvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves + INNER JOIN custbranch + ON stockmoves.debtorno=custbranch.debtorno + AND stockmoves.branchcode=custbranch.branchcode + INNER JOIN debtortrans + ON stockmoves.type=debtortrans.type + AND stockmoves.transno=debtortrans.transno + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND debtortrans.trandate>='" . $FromDate . "' + AND debtortrans.trandate<='" . $ToDate . "' + GROUP BY quarter_no, + transyear, + tpe + ORDER BY transyear, + quarter_no, + tpe"; + + break; + } + + $ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); + $SalesResult = DB_query($sql,$db,$ErrMsg); + + + echo '<table cellpadding=2 class="selection">'; + + echo'<tr> + <th>' . _('Period') . '</th> + <th>' . _('Sales') . '<br />' . _('Type') . '</th> + <th>' . _('No Orders') . '</th> + <th>' . _('Total Sales') . '</th> + <th>' . _('Refunds') . '</th> + <th>' . _('Net Sales') . '</th> + <th>' . _('Cost of Sales') . '</th> + <th>' . _('Gross Profit') . '</th> + </tr>'; + + $CumulativeTotalSales = 0; + $CumulativeTotalOrders = 0; + $CumulativeTotalRefunds = 0; + $CumulativeTotalNetSales = 0; + $CumulativeTotalCost = 0; + $CumulativeTotalGP = 0; + + $PrdTotalOrders =0; + $PrdTotalSales=0; + $PrdTotalRefunds=0; + $PrdTotalNetSales=0; + $PrdTotalCost=0; + $PrdTotalGP=0; + + $PeriodHeadingDone = false; + $LastPeriodHeading = 'First Run Through'; + $k=0; + while ($SalesRow=DB_fetch_array($SalesResult)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + switch ($_POST['DisplayData']){ + case 'Daily': + if ($LastPeriodHeading != ConvertSQLDate($SalesRow['trandate'])) { + $PeriodHeadingDone=false; + if ($LastPeriodHeading != 'First Run Through'){ //print the footer for the period + echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> + <td class="number">' . $PrdTotalOrders . '</td> + <td class="number">' . number_format($PrdTotalSales,2) . '</td> + <td class="number">' . number_format($PrdTotalRefunds,2) . '</td> + <td class="number">' . number_format($PrdTotalNetSales,2) . '</td> + <td class="number">' . number_format($PrdTotalCost,2) . '</td> + <td class="number">' . number_format($PrdTotalGP,2) . '</td> + </tr>'; + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + $PrdTotalOrders =0; + $PrdTotalSales=0; + $PrdTotalRefunds=0; + $PrdTotalNetSales=0; + $PrdTotalCost=0; + $PrdTotalGP=0; + } + } + if (! $PeriodHeadingDone){ + echo '<td>' . ConvertSQLDate($SalesRow['trandate']) . '</td>'; + $LastPeriodHeading = ConvertSQLDate($SalesRow['trandate']); + $PeriodHeadingDone = true; + } else { + echo '<td></td>'; + } + break; + case 'Weekly': + if ($LastPeriodHeading != _('wk'). '-' . $SalesRow['week_no'] . ' ' . $SalesRow['transyear']) { + $PeriodHeadingDone=false; + if ($LastPeriodHeading != 'First Run Through'){ + echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> + <td class="number">' . $PrdTotalOrders . '</td> + <td class="number">' . number_format($PrdTotalSales,2) . '</td> + <td class="number">' . number_format($PrdTotalRefunds,2) . '</td> + <td class="number">' . number_format($PrdTotalNetSales,2) . '</td> + <td class="number">' . number_format($PrdTotalCost,2) . '</td> + <td class="number">' . number_format($PrdTotalGP,2) . '</td> + </tr>'; + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + $PrdTotalOrders =0; + $PrdTotalSales=0; + $PrdTotalRefunds=0; + $PrdTotalNetSales=0; + $PrdTotalCost=0; + $PrdTotalGP=0; + } + } + if (! $PeriodHeadingDone){ + echo '<td>' . _('wk'). '-' . $SalesRow['week_no'] . ' ' . $SalesRow['transyear'] . '</td>'; + $LastPeriodHeading = _('wk'). '-' . $SalesRow['week_no'] . ' ' . $SalesRow['transyear']; + $PeriodHeadingDone = true; + } else { + echo '<td></td>'; + } + break; + case 'Monthly': + if ($LastPeriodHeading != $SalesRow['month_name'] . ' ' . $SalesRow['transyear']) { + $PeriodHeadingDone=false; + if ($LastPeriodHeading != 'First Run Through'){ + echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> + <td class="number">' . $PrdTotalOrders . '</td> + <td class="number">' . number_format($PrdTotalSales,2) . '</td> + <td class="number">' . number_format($PrdTotalRefunds,2) . '</td> + <td class="number">' . number_format($PrdTotalNetSales,2) . '</td> + <td class="number">' . number_format($PrdTotalCost,2) . '</td> + <td class="number">' . number_format($PrdTotalGP,2) . '</td> + </tr>'; + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + $PrdTotalOrders =0; + $PrdTotalSales=0; + $PrdTotalRefunds=0; + $PrdTotalNetSales=0; + $PrdTotalCost=0; + $PrdTotalGP=0; + } + } + if (! $PeriodHeadingDone){ + echo '<td>' . $SalesRow['month_name'] . ' ' . $SalesRow['transyear'] . '</td>'; + $LastPeriodHeading = $SalesRow['month_name'] . ' ' . $SalesRow['transyear']; + $PeriodHeadingDone = true; + } else { + echo '<td></td>'; + } + break; + case 'Quarterly': + if ($LastPeriodHeading != _('Qtr'). '-' . $SalesRow['quarter_no'] . ' ' . $SalesRow['transyear']) { + $PeriodHeadingDone=false; + if ($LastPeriodHeading != 'First Run Through'){ + echo '<td colspan="2" class="number">' . _('Total') . '-'. $LastPeriodHeading . '</td> + <td class="number">' . $PrdTotalOrders . '</td> + <td class="number">' . number_format($PrdTotalSales,2) . '</td> + <td class="number">' . number_format($PrdTotalRefunds,2) . '</td> + <td class="number">' . number_format($PrdTotalNetSales,2) . '</td> + <td class="number">' . number_format($PrdTotalCost,2) . '</td> + <td class="number">' . number_format($PrdTotalGP,2) . '</td> + </tr>'; + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + $PrdTotalOrders =0; + $PrdTotalSales=0; + $PrdTotalRefunds=0; + $PrdTotalNetSales=0; + $PrdTotalCost=0; + $PrdTotalGP=0; + } + } + if (! $PeriodHeadingDone){ + echo '<td>' . _('Qtr'). '-' . $SalesRow['quarter_no'] . ' ' . $SalesRow['transyear'] . '</td>'; + $LastPeriodHeading = _('Qtr'). '-' . $SalesRow['quarter_no'] . ' ' . $SalesRow['transyear']; + $PeriodHeadingDone = true; + } else { + echo '<td></td>'; + } + break; + } + echo '<td>' . $SalesRow['tpe'] . '</td> + <td class="number">' . $SalesRow['nooforders'] . '</td> + <td class="number">' . number_format($SalesRow['salesvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['returnvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['cost'],2) . '</td> + <td class="number">' . number_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),2) . '</td> + </tr>'; + $PrdTotalOrders +=$SalesRow['nooforders']; + $PrdTotalSales += $SalesRow['salesvalue']; + $PrdTotalRefunds += $SalesRow['returnvalue']; + $PrdTotalNetSales += ($SalesRow['salesvalue']+$SalesRow['returnvalue']); + $PrdTotalCost += $SalesRow['cost']; + $PrdTotalGP += ($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']); + + $CumulativeTotalSales += $SalesRow['salesvalue']; + $CumulativeTotalOrders = $SalesRow['nooforders']; + $CumulativeTotalRefunds += $SalesRow['returnvalue']; + $CumulativeTotalNetSales += ($SalesRow['salesvalue']+$SalesRow['returnvalue']); + $CumulativeTotalCost += $SalesRow['cost']; + $CumulativeTotalGP += ($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']); + } + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + echo '<td colspan="2" class="number">' . _('Total') . ' ' . $LastPeriodHeading . '</td> + <td class="number">' . $PrdTotalOrders . '</td> + <td class="number">' . number_format($PrdTotalSales,2) . '</td> + <td class="number">' . number_format($PrdTotalRefunds,2) . '</td> + <td class="number">' . number_format($PrdTotalNetSales,2) . '</td> + <td class="number">' . number_format($PrdTotalCost,2) . '</td> + <td class="number">' . number_format($PrdTotalGP,2) . '</td> + </tr>'; + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + echo '<td colspan="2" class="number">' . _('GRAND Total') . '</td> + <td class="number">' . $CumulativeTotalOrders . '</td> + <td class="number">' . number_format($CumulativeTotalSales,2) . '</td> + <td class="number">' . number_format($CumulativeTotalRefunds,2) . '</td> + <td class="number">' . number_format($CumulativeTotalNetSales,2) . '</td> + <td class="number">' . number_format($CumulativeTotalCost,2) . '</td> + <td class="number">' . number_format($CumulativeTotalGP,2) . '</td> + </tr>'; + + echo '</table>'; + +} //end of if user hit show sales +include('includes/footer.inc'); +?> \ No newline at end of file Added: trunk/SalesCategoryPeriodInquiry.php =================================================================== --- trunk/SalesCategoryPeriodInquiry.php (rev 0) +++ trunk/SalesCategoryPeriodInquiry.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -0,0 +1,220 @@ +<?php + +/* $Id: SalesCategoryPeriodInquiry.php 4261 2010-12-22 15:56:50Z $*/ + +include('includes/session.inc'); +$title = _('Sales Category Report'); +include('includes/header.inc'); +include('includes/DefineCartClass.php'); + +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Category Report') . '</p>'; +echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br>'; + +if (!isset($_POST['DateRange'])){ + /* then assume report is for This Month - maybe wrong to do this but hey better than reporting an error?*/ + $_POST['DateRange']='ThisMonth'; +} + +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +echo '<table cellpadding=2 class="selection">'; + +echo '<tr><th colspan="2" class="centre">' . _('Date Selection') . '</th> + </tr> + <tr> + <td>' . _('Custom Range') . ':</td> + <td><input type="radio" name="DateRange" value="Custom" '; +if ($_POST['DateRange']=='Custom'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Week') . ':</td> + <td><input type="radio" name="DateRange" value="ThisWeek" '; +if ($_POST['DateRange']=='ThisWeek'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Month') . ':</td> + <td><input type="radio" name="DateRange" value="ThisMonth" '; +if ($_POST['DateRange']=='ThisMonth'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Quarter') . ':</td> + <td><input type="radio" name="DateRange" value="ThisQuarter" '; +if ($_POST['DateRange']=='ThisQuarter'){ + echo 'checked'; +} +echo '></td> + </tr>'; +if ($_POST['DateRange']=='Custom'){ + echo '<tr> + <td>' . _('Date From') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Date To') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> + </tr>'; +} +echo '</table>'; + + +echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '">'; +echo '</form></div>'; +echo '<br />'; + +if ($_POST['DateRange']=='Custom' AND !isset($_POST['FromDate']) AND !isset($_POST['ToDate'])){ + //Don't run the report until custom dates entered + unset($_POST['ShowSales']); +} + +if (isset($_POST['ShowSales'])){ + $InputError=0; //assume no input errors now test for errors + if ($_POST['DateRange']=='Custom'){ + if (!Is_Date($_POST['FromDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the from date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (!Is_Date($_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the to date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (Date1GreaterThanDate2($_POST['FromDate'],$_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The from date is expected to be a date prior to the to date. Please review the selected date range'),'error'); + } + } + switch ($_POST['DateRange']) { + case 'ThisWeek': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w')+1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisMonth': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisQuarter': + switch (date('m')) { + case 1: + case 2: + case 3: + $QuarterStartMonth=1; + break; + case 4: + case 5: + case 6: + $QuarterStartMonth=4; + break; + case 7: + case 8: + case 9: + $QuarterStartMonth=7; + break; + default: + $QuarterStartMonth=10; + } + $FromDate = date('Y-m-d',mktime(0,0,0,$QuarterStartMonth,1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'Custom': + $FromDate = FormatDateForSQL($_POST['FromDate']); + $ToDate = FormatDateForSQL($_POST['ToDate']); + } + $sql = "SELECT stockmaster.categoryid, + stockcategory.categorydescription, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) as salesvalue, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) as returnvalue, + SUM(CASE WHEN stockmoves.type=11 + OR stockmoves.type=10 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) as netsalesvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND trandate>='" . $FromDate . "' + AND trandate<='" . $ToDate . "' + GROUP BY stockmaster.categoryid + ORDER BY netsalesvalue DESC"; + + $ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); + $SalesResult = DB_query($sql,$db,$ErrMsg); + $OrdersResult = DB_query($OrdersSQL,$db,$ErrMsg); + + echo '<table cellpadding=2 class="selection">'; + + echo'<tr> + <th>' . _('Category') . '</th> + <th>' . _('Total Sales') . '</th> + <th>' . _('Refunds') . '</th> + <th>' . _('Net Sales') . '</th> + <th>' . _('Cost of Sales') . '</th> + <th>' . _('Gross Profit') . '</th> + </tr>'; + + $CumulativeTotalSales = 0; + $CumulativeTotalRefunds = 0; + $CumulativeTotalNetSales = 0; + $CumulativeTotalCost = 0; + $CumulativeTotalGP = 0; + + $k=0; + while ($SalesRow=DB_fetch_array($SalesResult)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + echo '<td>' . $SalesRow['categoryid'] . ' - ' . $SalesRow['categorydescription'] . '</td> + <td class="number">' . number_format($SalesRow['salesvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['returnvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['cost'],2) . '</td> + <td class="number">' . number_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),2) . '</td> + </tr>'; + + $CumulativeTotalSales += $SalesRow['salesvalue']; + $CumulativeTotalRefunds += $SalesRow['returnvalue']; + $CumulativeTotalNetSales += ($SalesRow['salesvalue']+$SalesRow['returnvalue']); + $CumulativeTotalCost += $SalesRow['cost']; + $CumulativeTotalGP += ($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']); + } //loop around category sales for the period + + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + echo '<td class="number">' . _('GRAND Total') . '</td> + <td class="number">' . number_format($CumulativeTotalSales,2) . '</td> + <td class="number">' . number_format($CumulativeTotalRefunds,2) . '</td> + <td class="number">' . number_format($CumulativeTotalNetSales,2) . '</td> + <td class="number">' . number_format($CumulativeTotalCost,2) . '</td> + <td class="number">' . number_format($CumulativeTotalGP,2) . '</td> + </tr>'; + + echo '</table>'; + +} //end of if user hit show sales +include('includes/footer.inc'); +?> \ No newline at end of file Modified: trunk/SalesGLPostings.php =================================================================== --- trunk/SalesGLPostings.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/SalesGLPostings.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -92,7 +92,7 @@ $ShowLivePostingRecords = true; - $SQL = 'SELECT salesglpostings.id, + $SQL = "SELECT salesglpostings.id, salesglpostings.area, salesglpostings.stkcat, salesglpostings.salestype, @@ -100,7 +100,7 @@ salesglpostings.discountglcode FROM salesglpostings LEFT JOIN chartmaster ON salesglpostings.salesglcode = chartmaster.accountcode - WHERE chartmaster.accountcode IS NULL'; + WHERE chartmaster.accountcode IS NULL"; $result = DB_query($SQL,$db); if (DB_num_rows($result)>0){ @@ -124,13 +124,13 @@ $k=1; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%sSelectedSalesPostingID=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedSalesPostingID=%s&delete=yes\">". _('Delete') . "</td></tr>", + <td><a href="%sSelectedSalesPostingID=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedSalesPostingID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales GL posting record?') . '\');">'. _('Delete') . '</td></tr>', $myrow[1], $myrow[2], $myrow[3], @@ -143,11 +143,11 @@ } } - $SQL = 'SELECT salesglpostings.id, + $SQL = "SELECT salesglpostings.id, salesglpostings.area, salesglpostings.stkcat, salesglpostings.salestype - FROM salesglpostings'; + FROM salesglpostings"; $result = DB_query($SQL,$db); @@ -203,7 +203,7 @@ } if ($ShowLivePostingRecords){ - $SQL = 'SELECT salesglpostings.id, + $SQL = "SELECT salesglpostings.id, salesglpostings.area, salesglpostings.stkcat, salesglpostings.salestype, @@ -213,12 +213,13 @@ chartmaster as chart1, chartmaster as chart2 WHERE salesglpostings.salesglcode = chart1.accountcode - AND salesglpostings.discountglcode = chart2.accountcode'; + AND salesglpostings.discountglcode = chart2.accountcode"; $result = DB_query($SQL,$db); - echo '<table class=selection>'; - echo '<tr><th>' . _('Area') . '</th> + echo '<table class=selection> + <tr> + <th>' . _('Area') . '</th> <th>' . _('Stock Category') . '</th> <th>' . _('Sales Type') . '</th> <th>' . _('Sales Account') . '</th> @@ -236,13 +237,13 @@ $k=1; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%sSelectedSalesPostingID=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedSalesPostingID=%s&delete=yes\">". _('Delete') . "</td></tr>", + <td><a href="%sSelectedSalesPostingID=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedSalesPostingID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales GL posting record?') . '\');">'. _('Delete') . '</td></tr>', $myrow[1], $myrow[2], $myrow[3], @@ -296,21 +297,21 @@ } /*end of if $SelectedSalesPostingID only do the else when a new record is being entered */ - $SQL = 'SELECT areacode, - areadescription FROM areas'; + $SQL = "SELECT areacode, + areadescription FROM areas"; $result = DB_query($SQL,$db); - echo '<br /><table class=selection> + echo '<br /><table class="selection"> <tr> <td>' . _('Area') . ':</td> <td><select name="Area"> - <option VALUE="AN">' . _('Any Other') . '</option>'; + <option value="AN">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['Area']) and $myrow['areacode']==$_POST['Area']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['areacode'] . '">'. $myrow['areadescription'] . '</option>'; @@ -318,7 +319,7 @@ DB_free_result($result); - $SQL = 'SELECT categoryid, categorydescription FROM stockcategory'; + $SQL = "SELECT categoryid, categorydescription FROM stockcategory"; $result = DB_query($SQL,$db); echo '</select></td></tr>'; @@ -326,7 +327,7 @@ echo '<tr><td>' . _('Stock Category') . ':</td> <td><select name="StkCat"> - <option VALUE="ANY">' . _('Any Other') . '</option>'; + <option value="ANY">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { @@ -344,21 +345,21 @@ DB_free_result($result); - $SQL = 'SELECT typeabbrev, + $SQL = "SELECT typeabbrev, sales_type - FROM salestypes'; + FROM salestypes"; $result = DB_query($SQL,$db); echo '<tr><td>' . _('Sales Type') . ' / ' . _('Price List') . ':</td> <td><select name="SalesType">'; - echo '<option VALUE="AN">' . _('Any Other') . '</option>'; + echo '<option value="AN">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SalesType']) and $myrow['typeabbrev']==$_POST['SalesType']) { - echo '<option selected VALUE="'; + echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; @@ -386,7 +387,7 @@ if (isset($_POST['SalesGLCode']) and $myrow['accountcode']==$_POST['SalesGLCode']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; @@ -404,7 +405,7 @@ } else { echo '<option value="'; } - echo $myrow['accountcode'] . "'>" . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; + echo $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; } //end while loop Added: trunk/SalesTopItemsInquiry.php =================================================================== --- trunk/SalesTopItemsInquiry.php (rev 0) +++ trunk/SalesTopItemsInquiry.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -0,0 +1,275 @@ +<?php + +/* $Id: SalesTopItemsInquiry.php 4261 2010-12-22 15:56:50Z $*/ + +include('includes/session.inc'); +$title = _('Sales Category Report'); +include('includes/header.inc'); +include('includes/DefineCartClass.php'); + +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Category Report') . '</p>'; +echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br>'; + +if (!isset($_POST['DateRange'])){ + /* then assume report is for This Month - maybe wrong to do this but hey better than reporting an error?*/ + $_POST['DateRange']='ThisMonth'; +} + +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +echo '<table cellpadding=2 class="selection"> + <tr><td valign=top> + <table>'; + +echo '<tr><th colspan="2" class="centre">' . _('Date Selection') . '</th> + </tr> + <tr> + <td>' . _('Custom Range') . ':</td> + <td><input type="radio" name="DateRange" value="Custom" '; +if ($_POST['DateRange']=='Custom'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Week') . ':</td> + <td><input type="radio" name="DateRange" value="ThisWeek" '; +if ($_POST['DateRange']=='ThisWeek'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Month') . ':</td> + <td><input type="radio" name="DateRange" value="ThisMonth" '; +if ($_POST['DateRange']=='ThisMonth'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Quarter') . ':</td> + <td><input type="radio" name="DateRange" value="ThisQuarter" '; +if ($_POST['DateRange']=='ThisQuarter'){ + echo 'checked'; +} +echo '></td> + </tr>'; +if ($_POST['DateRange']=='Custom'){ + echo '<tr> + <td>' . _('Date From') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Date To') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> + </tr>'; +} +echo '</table></td> + <td valign=top> + <table>'; //new sub table to set parameters for order of display + + +if (!isset($_POST['OrderBy'])){ //default to order by net sales + $_POST['OrderBy']='NetSales'; +} +echo '<tr><th colspan="2" class="centre">' . _('Display') . '</th> + </tr> + <tr> + <td>' . _('Order By Net Sales') . ':</td> + <td><input type="radio" name="OrderBy" value="NetSales" '; +if ($_POST['OrderBy']=='NetSales'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('Order By Quantity') . ':</td> + <td><input type="radio" name="OrderBy" value="Quantity" '; +if ($_POST['OrderBy']=='Quantity'){ + echo 'checked'; +} +if (!isset($_POST['NoToDisplay'])){ + $_POST['NoToDisplay']=20; +} +echo '></td> + </tr> + <tr> + <td>' . _('Number to Display') . ':</td> + <td><input type="text class="number" name="NoToDisplay" size="4" maxlength="4" value="' . $_POST['NoToDisplay'] .'" ></td> + </tr> + </table> + </td></tr> + </table>'; + + +echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '">'; +echo '</form></div>'; +echo '<br />'; + +if ($_POST['DateRange']=='Custom' AND !isset($_POST['FromDate']) AND !isset($_POST['ToDate'])){ + //Don't run the report until custom dates entered + unset($_POST['ShowSales']); +} + +if (isset($_POST['ShowSales'])){ + $InputError=0; //assume no input errors now test for errors + if ($_POST['DateRange']=='Custom'){ + if (!Is_Date($_POST['FromDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the from date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (!Is_Date($_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the to date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (Date1GreaterThanDate2($_POST['FromDate'],$_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The from date is expected to be a date prior to the to date. Please review the selected date range'),'error'); + } + } + switch ($_POST['DateRange']) { + case 'ThisWeek': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w')+1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisMonth': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisQuarter': + switch (date('m')) { + case 1: + case 2: + case 3: + $QuarterStartMonth=1; + break; + case 4: + case 5: + case 6: + $QuarterStartMonth=4; + break; + case 7: + case 8: + case 9: + $QuarterStartMonth=7; + break; + default: + $QuarterStartMonth=10; + } + $FromDate = date('Y-m-d',mktime(0,0,0,$QuarterStartMonth,1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'Custom': + $FromDate = FormatDateForSQL($_POST['FromDate']); + $ToDate = FormatDateForSQL($_POST['ToDate']); + } + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockcategory.categorydescription, + SUM(CASE WHEN stockmoves.type=10 + OR stockmoves.type=11 THEN + -qty + ELSE 0 END) as salesquantity, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) as salesvalue, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) as returnvalue, + SUM(CASE WHEN stockmoves.type=11 + OR stockmoves.type=10 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) as netsalesvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND trandate>='" . $FromDate . "' + AND trandate<='" . $ToDate . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockcategory.categorydescription "; + + if ($_POST['OrderBy']=='NetSales'){ + $sql .= " ORDER BY netsalesvalue DESC "; + } else { + $sql .= " ORDER BY salesquantity DESC "; + } + if (is_numeric($_POST['NoToDisplay'])){ + if ($_POST['NoToDisplay'] > 0){ + $sql .= " LIMIT " . $_POST['NoToDisplay']; + } + } + + $ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); + $SalesResult = DB_query($sql,$db,$ErrMsg); + + + echo '<table cellpadding=2 class="selection">'; + + echo'<tr> + <th>' . _('Rank') . '</th> + <th>' . _('Item') . '</th> + <th>' . _('Category') . '</th> + <th>' . _('Sales Value') . '</th> + <th>' . _('Refunds') . '</th> + <th>' . _('Net Sales') . '</th> + <th>' . _('Sales') .'<br />' . _('Quantity') . '</th> + </tr>'; + + $CumulativeTotalSales = 0; + $CumulativeTotalRefunds = 0; + $CumulativeTotalNetSales = 0; + $CumulativeTotalQuantity = 0; + $i=1; + $k=0; + while ($SalesRow=DB_fetch_array($SalesResult)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + echo '<td>' . $i . '</td> + <td>' . $SalesRow['stockid'] . ' - ' . $SalesRow['description'] . '</td> + <td>' . $SalesRow['categorydescription'] . '</td> + <td class="number">' . number_format($SalesRow['salesvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['returnvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['netsalesvalue'],2) . '</td> + <td class="number">' . $SalesRow['salesquantity'] . '</td> + </tr>'; + $i++; + + $CumulativeTotalSales += $SalesRow['salesvalue']; + $CumulativeTotalRefunds += $SalesRow['returnvalue']; + $CumulativeTotalNetSales += ($SalesRow['salesvalue']+$SalesRow['returnvalue']); + $CumulativeTotalQuantity += $SalesRow['salesquantity']; + + } //loop around category sales for the period + + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + echo '<td class="number" colspan=3>' . _('GRAND Total') . '</td> + <td class="number">' . number_format($CumulativeTotalSales,2) . '</td> + <td class="number">' . number_format($CumulativeTotalRefunds,2) . '</td> + <td class="number">' . number_format($CumulativeTotalNetSales,2) . '</td> + <td class="number">' . $CumulativeTotalQuantity . '</td> + </tr>'; + + echo '</table>'; + +} //end of if user hit show sales +include('includes/footer.inc'); +?> \ No newline at end of file Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/UpgradeDatabase.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -109,7 +109,9 @@ case '4.03RC2': case '4.03': case '4.03.2': + case '4.03.3': case '4.03.5': + case '4.03.6': case '4.03.7': $SQLScripts[] = './sql/mysql/upgrade3.11.1-4.00.sql'; case '4.03.8': Modified: trunk/build/make_release.sh =================================================================== --- trunk/build/make_release.sh 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/build/make_release.sh 2011-05-25 10:30:45 UTC (rev 4574) @@ -67,6 +67,8 @@ msgfmt -o locale/zh_HK.utf8/LC_MESSAGES/messages.mo locale/zh_HK.utf8/LC_MESSAGES/messages.po msgfmt -o locale/vi_VN.utf8/LC_MESSAGES/messages.mo locale/vi_VN.utf8/LC_MESSAGES/messages.po +mysql -u$MYSQL_USER -p$MYSQL_PWD < $BASE_DIR/build/TruncateAuditTrail.sql + echo "SET FOREIGN_KEY_CHECKS = 0;" > $BASE_DIR/sql/mysql/weberp-new.sql mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --create-options --skip-set-charset --ignore-table=weberpdemo.mrpsupplies --ignore-table=weberpdemo.mrpplanedorders --ignore-table=weberpdemo.mrpparameters --ignore-table=weberpdemo.levels --ignore-table=weberpdemo.mrprequirements --ignore-table=weberpdemo.audittrail --no-data weberpdemo >> $BASE_DIR/sql/mysql/weberp-new.sql @@ -118,7 +120,6 @@ echo "UPDATE systypes SET typeno=0;" >> $BASE_DIR/sql/mysql/weberp-new.sql echo "INSERT INTO shippers VALUES (1,'Default Shipper',0);" >> $BASE_DIR/sql/mysql/weberp-new.sql echo "UPDATE config SET confvalue='1' WHERE confname='Default_Shipper';" >> $BASE_DIR/sql/mysql/weberp-new.sql -echo "TRUNCATE TABLE audittrail;" >> $BASE_DIR/sql/mysql/weberp-demo.sql echo "SET FOREIGN_KEY_CHECKS = 1;" >> $BASE_DIR/sql/mysql/weberp-demo.sql rm $OUTPUT_DIR/webERP.zip Modified: trunk/config.distrib.php =================================================================== --- trunk/config.distrib.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/config.distrib.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -18,7 +18,7 @@ // The timezone of the business - this allows the possibility of having // the web-server on a overseas machine but record local time // this is not necessary if you have your own server locally -// putenv('TZ=Europe/London'); +putenv('TZ=Europe/London'); // putenv('TZ=Australia/Melbourne'); // putenv('TZ=Australia/Sydney'); // putenv('TZ=Pacific/Auckland'); @@ -86,8 +86,8 @@ if ($rootpath == "/" OR $rootpath == "\\") { $rootpath = ""; } -//$rootpath = '/web-erp'; + /* Report all errors except E_NOTICE This is the default value set in php.ini for most installations but just to be sure it is forced here turning on NOTICES destroys things */ @@ -95,4 +95,4 @@ error_reporting (E_ALL && ~E_NOTICE); /*Make sure there is nothing - not even spaces after this last ?> */ -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/doc/Change.log 2011-05-25 10:30:45 UTC (rev 4574) @@ -1,5 +1,7 @@ webERP Change Log +25/5/11 New Sales Inquiry scripts by sales type/price list by category and top sellers +24/5/11 Updated from launchpad translations those that had changed from 18/4/11 including Viatnamese, Albanian, Russian, Spanish 23/5/11 Tim: Remove SystemCheck.php and code standards changes(launchpad 4711-4718) 23/5/11 Tim: Make link from SelectProduct.php to place purchase orders factor in the lead time into the delivery date in the purchase order (launchpad 4710) 23/5/11 Exson: fix PaymentMethods could not add new - comma missing in INSERT SQL Modified: trunk/doc/Manual/ManualContents.php =================================================================== --- trunk/doc/Manual/ManualContents.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/doc/Manual/ManualContents.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -21,7 +21,7 @@ -->';*/ $PathPrefix='../../'; -include($PathPrefix.'includes/session.inc'); +//include($PathPrefix.'includes/session.inc'); include('ManualHeader.html'); ?> Modified: trunk/index.php =================================================================== --- trunk/index.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/index.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -188,6 +188,22 @@ </tr> <tr> <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/SalesByTypePeriodInquiry.php">' . _('Sales By Sales Type Inquiry') . '</a></p>'; ?> + </td> + </tr> + <tr> + <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/SalesCategoryPeriodInquiry.php">' . _('Sales By Category Inquiry') . '</a></p>'; ?> + </td> + </tr> + <tr> + <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/SalesTopItemsInquiry.php">' . _('Top Sellers Inquiry') . '</a></p>'; ?> + </td> + </tr> + + <tr> + <td class="menu_group_item"> <?php echo '<p>• <a href="' . $rootpath . '/PDFDeliveryDifferences.php">' . _('Order Delivery Differences Report') . '</a></p>'; ?> </td> </tr> Modified: trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.mo =================================================================== (Binary files differ) Modified: trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po =================================================================== --- trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po 2011-05-25 10:30:45 UTC (rev 4574) @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: webERP 3.08\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-29 20:59+1200\n" +"POT-Creation-Date: 2011-05-24 21:53+1200\n" "PO-Revision-Date: 2011-02-07 15:33+0000\n" "Last-Translator: Tim Schofield <Unknown>\n" "Language-Team: Czech <cs...@li...>\n" @@ -21,7 +21,7 @@ "X-Poedit-Language: Czech\n" "X-Poedit-SourceCharset: utf-8\n" -#: AccountGroups.php:7 index.php:1275 +#: AccountGroups.php:7 index.php:1280 msgid "Account Groups" msgstr "Účetní skupiny" @@ -58,8 +58,8 @@ msgid "The account group name cannot contain the character" msgstr "Název účetní skupiny nemůže obsahovat znak" -#: AccountGroups.php:69 AccountSections.php:75 TaxCategories.php:33 -#: TaxProvinces.php:30 UnitsOfMeasure.php:30 +#: AccountGroups.php:69 TaxCategories.php:31 TaxProvinces.php:30 +#: UnitsOfMeasure.php:30 msgid "or the character" msgstr "nebo znak" @@ -101,7 +101,7 @@ msgid "The SQL that was used to update the account group was" msgstr "SQL, který byl použit k aktualizaci účtu skupina byla" -#: AccountGroups.php:137 AccountSections.php:106 PaymentMethods.php:90 +#: AccountGroups.php:137 AccountSections.php:104 PaymentMethods.php:82 msgid "Record Updated" msgstr "Záznam aktualizován" @@ -113,7 +113,7 @@ msgid "The SQL that was used to insert the account group was" msgstr "SQL, který byl použit pro vložení na účet skupina byla" -#: AccountGroups.php:157 AccountSections.php:118 PaymentMethods.php:114 +#: AccountGroups.php:157 AccountSections.php:116 PaymentMethods.php:106 msgid "Record inserted" msgstr "Záznam vložen" @@ -129,24 +129,24 @@ "Nelze smazat tento účet skupiny, protože účtů hlavní knihy byly vytvořeny " "pomocí této skupině" -#: AccountGroups.php:180 AccountGroups.php:190 AccountSections.php:139 -#: Areas.php:117 Areas.php:126 BankAccounts.php:163 CreditStatus.php:126 -#: Currencies.php:144 Currencies.php:152 Currencies.php:159 +#: AccountGroups.php:180 AccountGroups.php:190 AccountSections.php:137 +#: Areas.php:116 Areas.php:125 BankAccounts.php:157 CreditStatus.php:125 +#: Currencies.php:143 Currencies.php:151 Currencies.php:158 #: CustomerBranches.php:286 CustomerBranches.php:296 CustomerBranches.php:306 #: CustomerBranches.php:316 Customers.php:311 Customers.php:320 #: Customers.php:328 Customers.php:336 CustomerTypes.php:147 -#: CustomerTypes.php:157 Factors.php:136 FixedAssetCategories.php:131 +#: CustomerTypes.php:157 Factors.php:134 FixedAssetCategories.php:130 #: GLAccounts.php:80 GLAccounts.php:94 Locations.php:244 Locations.php:252 #: Locations.php:261 Locations.php:269 Locations.php:277 Locations.php:285 #: Locations.php:293 Locations.php:301 MRPDemandTypes.php:87 -#: PaymentMethods.php:148 PaymentTerms.php:147 PaymentTerms.php:154 -#: PcExpenses.php:128 SalesCategories.php:127 SalesCategories.php:135 -#: SalesPeople.php:144 SalesPeople.php:151 SalesTypes.php:147 -#: SalesTypes.php:157 Shippers.php:82 Shippers.php:94 StockCategories.php:179 +#: PaymentMethods.php:140 PaymentTerms.php:147 PaymentTerms.php:154 +#: PcExpenses.php:152 SalesCategories.php:125 SalesCategories.php:133 +#: SalesPeople.php:144 SalesPeople.php:151 SalesTypes.php:145 +#: SalesTypes.php:155 Shippers.php:82 Shippers.php:94 StockCategories.php:179 #: Stocks.php:475 Stocks.php:484 Stocks.php:492 Stocks.php:500 Stocks.php:508 #: Stocks.php:516 Suppliers.php:609 Suppliers.php:618 Suppliers.php:626 -#: SupplierTypes.php:145 TaxCategories.php:133 TaxGroups.php:127 -#: TaxGroups.php:134 TaxProvinces.php:125 UnitsOfMeasure.php:137 +#: SupplierTypes.php:145 TaxCategories.php:131 TaxGroups.php:127 +#: TaxGroups.php:134 TaxProvinces.php:125 UnitsOfMeasure.php:138 #: WorkCentres.php:89 WorkCentres.php:95 WWW_Access.php:83 msgid "There are" msgstr "Jsou zde" @@ -192,35 +192,36 @@ msgid "Could not get account groups because" msgstr "Nemohu získat účetní sk... [truncated message content] |
From: <dai...@us...> - 2011-05-25 10:30:55
|
Revision: 4574 http://web-erp.svn.sourceforge.net/web-erp/?rev=4574&view=rev Author: daintree Date: 2011-05-25 10:30:45 +0000 (Wed, 25 May 2011) Log Message: ----------- new sales inquiries Modified Paths: -------------- trunk/COGSGLPostings.php trunk/PeriodsInquiry.php trunk/SalesGLPostings.php trunk/UpgradeDatabase.php trunk/build/make_release.sh trunk/config.distrib.php trunk/doc/Change.log trunk/doc/Manual/ManualContents.php trunk/index.php trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.mo trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po trunk/locale/de_DE.utf8/LC_MESSAGES/messages.mo trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po trunk/locale/el_GR.utf8/LC_MESSAGES/messages.mo trunk/locale/el_GR.utf8/LC_MESSAGES/messages.po trunk/locale/en_GB.utf8/LC_MESSAGES/messages.pot trunk/locale/en_US.utf8/LC_MESSAGES/messages.mo trunk/locale/en_US.utf8/LC_MESSAGES/messages.po trunk/locale/es_ES.utf8/LC_MESSAGES/messages.mo trunk/locale/es_ES.utf8/LC_MESSAGES/messages.po trunk/locale/et_EE.utf8/LC_MESSAGES/messages.mo trunk/locale/et_EE.utf8/LC_MESSAGES/messages.po trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.mo trunk/locale/fa_IR.utf8/LC_MESSAGES/messages.po trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.mo trunk/locale/fr_FR.utf8/LC_MESSAGES/messages.po trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.mo trunk/locale/hi_IN.utf8/LC_MESSAGES/messages.po trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.mo trunk/locale/hr_HR.utf8/LC_MESSAGES/messages.po trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.mo trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.po trunk/locale/id_ID.utf8/LC_MESSAGES/messages.mo trunk/locale/id_ID.utf8/LC_MESSAGES/messages.po trunk/locale/it_IT.utf8/LC_MESSAGES/messages.mo trunk/locale/it_IT.utf8/LC_MESSAGES/messages.po trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.mo trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.po trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.mo trunk/locale/lv_LV.utf8/LC_MESSAGES/messages.po trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.mo trunk/locale/nl_NL.utf8/LC_MESSAGES/messages.po trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.mo trunk/locale/pl_PL.utf8/LC_MESSAGES/messages.po trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.po trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.mo trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.po trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.mo trunk/locale/ro_RO.utf8/LC_MESSAGES/messages.po trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.mo trunk/locale/ru_RU.utf8/LC_MESSAGES/messages.po trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.mo trunk/locale/sq_AL.utf8/LC_MESSAGES/messages.po trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.mo trunk/locale/sv_SE.utf8/LC_MESSAGES/messages.po trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.mo trunk/locale/sw_KE.utf8/LC_MESSAGES/messages.po trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.mo trunk/locale/tr_TR.utf8/LC_MESSAGES/messages.po trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.mo trunk/locale/vi_VN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_CN.utf8/LC_MESSAGES/messages.po trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.mo trunk/locale/zh_HK.utf8/LC_MESSAGES/messages.po trunk/sql/mysql/upgrade4.03-4.04.sql trunk/sql/mysql/weberp-demo.sql trunk/sql/mysql/weberp-new.sql Added Paths: ----------- trunk/SalesByTypePeriodInquiry.php trunk/SalesCategoryPeriodInquiry.php trunk/SalesTopItemsInquiry.php Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/COGSGLPostings.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -84,7 +84,7 @@ if (DB_num_rows($result)>0){ $ShowLivePostingRecords = false; prnMsg (_('The following cost of sales posting records that do not have valid general ledger code specified - these records must be amended.'),'error'); - echo '<table class=selection>'; + echo '<table class="selection">'; echo '<tr><th>' . _('Area') . '</th> <th>' . _('Stock Category') . '</th> <th>' . _('Sales Type') . '</th> @@ -209,7 +209,7 @@ <td>%s</td> <td>%s</td> <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">' . _('Delete') . '</td> + <td><a href="%sSelectedCOGSPostingID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this COGS GL posting record?') . '\');">' . _('Delete') . '</td> </tr>', $myrow['area'], $myrow['stkcat'], Modified: trunk/PeriodsInquiry.php =================================================================== --- trunk/PeriodsInquiry.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/PeriodsInquiry.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -1,10 +1,7 @@ <?php /* $Id$*/ -/* $Revision: 1.8 $ */ -//$PageSecurity = 2; - include ('includes/session.inc'); $title = _('Periods Inquiry'); @@ -13,13 +10,13 @@ $SQL = "SELECT periodno , lastdate_in_period - FROM periods - ORDER BY periodno"; + FROM periods + ORDER BY periodno"; $ErrMsg = _('No periods were returned by the SQL because'); $PeriodsResult = DB_query($SQL,$db,$ErrMsg); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; /*show a table of the orders returned by the SQL */ @@ -28,16 +25,18 @@ $PeriodsInTable = round($NumberOfPeriods/3,0); $TableHeader = '<tr><th>' . _('Period Number') . '</th> - <th>' . _('Date of Last Day') . '</th> - </tr>'; + <th>' . _('Date of Last Day') . '</th> + </tr>'; + echo '<table><tr>'; -for ($i=0;$i<2;$i++) { - echo '<td>'; - echo '<table cellpadding=2 colspan=2 class=selection>'; + +for ($i=0;$i<3;$i++) { + echo '<td valign="top">'; + echo '<table cellpadding=2 colspan=2 class="selection">'; echo $TableHeader; $k=0; - for ($j=0; $j<$PeriodsInTable;$j++) { - $myrow=DB_fetch_array($PeriodsResult); + $j=0; + while ($myrow=DB_fetch_array($PeriodsResult)){ if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -45,33 +44,18 @@ echo '<tr class="OddTableRows">'; $k++; } - $FormatedLastDate = ConvertSQLDate($myrow['lastdate_in_period']); - echo "<td>".$myrow['periodno']."</td> - <td>".$FormatedLastDate."</td> - </tr>"; + echo '<td>' . $myrow['periodno'] . '</td> + <td>' . ConvertSQLDate($myrow['lastdate_in_period']) . '</td> + </tr>'; + $j++; + if ($j==$PeriodsInTable){ + break; + } } echo '</table>'; echo '</td>'; } -echo '<td>'; -echo '<table cellpadding=2 colspan=2 class=selection>'; -echo $TableHeader; -$k = 0; //row colour counter -while ($myrow=DB_fetch_array($PeriodsResult)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k++; - } - $FormatedLastDate = ConvertSQLDate($myrow['lastdate_in_period']); - echo "<td>".$myrow['periodno']."</td> - <td>".$FormatedLastDate."</td> - </tr>"; -} -echo '</table>'; -echo '</td>'; + echo '</tr></table>'; //end of while loop Added: trunk/SalesByTypePeriodInquiry.php =================================================================== --- trunk/SalesByTypePeriodInquiry.php (rev 0) +++ trunk/SalesByTypePeriodInquiry.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -0,0 +1,560 @@ +<?php + +/* $Id: SalesByTypePeriodInquiry.php 4261 2010-12-22 15:56:50Z tim_schofield $*/ + +include('includes/session.inc'); +$title = _('Sales Report'); +include('includes/header.inc'); +include('includes/DefineCartClass.php'); + +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Report') . '</p>'; +echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br>'; + +if (!isset($_POST['DisplayData'])){ + /* then assume to display daily - maybe wrong to do this but hey better than reporting an error?*/ + $_POST['DisplayData']='Weekly'; +} +if (!isset($_POST['DateRange'])){ + /* then assume report is for This Month - maybe wrong to do this but hey better than reporting an error?*/ + $_POST['DateRange']='ThisMonth'; +} + +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +echo '<table cellpadding=2 class="selection"> + <tr><td valign=top> + <table>'; + +echo '<tr><th colspan="2" class="centre">' . _('Date Selection') . '</th> + </tr> + <tr> + <td>' . _('Custom Range') . ':</td> + <td><input type="radio" name="DateRange" value="Custom" '; +if ($_POST['DateRange']=='Custom'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Week') . ':</td> + <td><input type="radio" name="DateRange" value="ThisWeek" '; +if ($_POST['DateRange']=='ThisWeek'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Month') . ':</td> + <td><input type="radio" name="DateRange" value="ThisMonth" '; +if ($_POST['DateRange']=='ThisMonth'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Quarter') . ':</td> + <td><input type="radio" name="DateRange" value="ThisQuarter" '; +if ($_POST['DateRange']=='ThisQuarter'){ + echo 'checked'; +} +echo '></td> + </tr>'; +if ($_POST['DateRange']=='Custom'){ + echo '<tr> + <td>' . _('Date From') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Date To') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> + </tr>'; +} +echo '</table> + </td><td valign=top> + <table>'; + +echo '<tr><th colspan="2" class="centre">' . _('Display Data') . '</th> + </tr> + <tr> + <td>' . _('Daily') . ':</td> + <td><input type="radio" name="DisplayData" value="Daily" '; +if ($_POST['DisplayData']=='Daily'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('Weekly') . ':</td> + <td><input type="radio" name="DisplayData" value="Weekly" '; +if ($_POST['DisplayData']=='Weekly'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('Monthly') . ':</td> + <td><input type="radio" name="DisplayData" value="Monthly" '; +if ($_POST['DisplayData']=='Monthly'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('Quarterly') . ':</td> + <td><input type="radio" name="DisplayData" value="Quarterly" '; +if ($_POST['DisplayData']=='Monthly'){ + echo 'checked'; +} +echo '></td> + </tr>'; +echo '</table> + </td></tr> + </table>'; + + +echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '">'; +echo '</form></div>'; +echo '<br />'; + +if ($_POST['DateRange']=='Custom' AND !isset($_POST['FromDate']) AND !isset($_POST['ToDate'])){ + //Don't run the report until custom dates entered + unset($_POST['ShowSales']); +} + +if (isset($_POST['ShowSales'])){ + $InputError=0; //assume no input errors now test for errors + if ($_POST['DateRange']=='Custom'){ + if (!Is_Date($_POST['FromDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the from date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (!Is_Date($_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the to date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (Date1GreaterThanDate2($_POST['FromDate'],$_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The from date is expected to be a date prior to the to date. Please review the selected date range'),'error'); + } + } + switch ($_POST['DateRange']) { + case 'ThisWeek': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w')+1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisMonth': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisQuarter': + switch (date('m')) { + case 1: + case 2: + case 3: + $QuarterStartMonth=1; + break; + case 4: + case 5: + case 6: + $QuarterStartMonth=4; + break; + case 7: + case 8: + case 9: + $QuarterStartMonth=7; + break; + default: + $QuarterStartMonth=10; + } + $FromDate = date('Y-m-d',mktime(0,0,0,$QuarterStartMonth,1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'Custom': + $FromDate = FormatDateForSQL($_POST['FromDate']); + $ToDate = FormatDateForSQL($_POST['ToDate']); + } + switch ($_POST['DisplayData']) { + case 'Daily': + $sql = "SELECT debtortrans.trandate, + debtortrans.tpe, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) + as salesvalue, + SUM(CASE WHEN stockmoves.type=10 THEN + 1 ELSE 0 END) + as nooforders, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) + as returnvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves + INNER JOIN custbranch + ON stockmoves.debtorno=custbranch.debtorno + AND stockmoves.branchcode=custbranch.branchcode + INNER JOIN debtortrans + ON stockmoves.type=debtortrans.type + AND stockmoves.transno=debtortrans.transno + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND debtortrans.trandate>='" . $FromDate . "' + AND debtortrans.trandate<='" . $ToDate . "' + GROUP BY debtortrans.trandate, + tpe + ORDER BY debtortrans.trandate, + tpe"; + + break; + case 'Weekly': + $sql = "SELECT WEEKOFYEAR(debtortrans.trandate) as week_no, + YEAR(debtortrans.trandate) as transyear, + debtortrans.tpe, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) + as salesvalue, + SUM(CASE WHEN stockmoves.type=10 THEN + 1 ELSE 0 END) + as nooforders, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) + as returnvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves + INNER JOIN custbranch + ON stockmoves.debtorno=custbranch.debtorno + AND stockmoves.branchcode=custbranch.branchcode + INNER JOIN debtortrans + ON stockmoves.type=debtortrans.type + AND stockmoves.transno=debtortrans.transno + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND debtortrans.trandate>='" . $FromDate . "' + AND debtortrans.trandate<='" . $ToDate . "' + GROUP BY week_no, + transyear, + tpe + ORDER BY transyear, + week_no, + tpe"; + + break; + case 'Monthly': + $sql = "SELECT MONTH(debtortrans.trandate) as month_no, + MONTHNAME(debtortrans.trandate) as month_name, + YEAR(debtortrans.trandate) as transyear, + debtortrans.tpe, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) + as salesvalue, + SUM(CASE WHEN stockmoves.type=10 THEN + 1 ELSE 0 END) + as nooforders, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) + as returnvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves + INNER JOIN custbranch + ON stockmoves.debtorno=custbranch.debtorno + AND stockmoves.branchcode=custbranch.branchcode + INNER JOIN debtortrans + ON stockmoves.type=debtortrans.type + AND stockmoves.transno=debtortrans.transno + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND debtortrans.trandate>='" . $FromDate . "' + AND debtortrans.trandate<='" . $ToDate . "' + GROUP BY month_no, + month_name, + transyear, + debtortrans.tpe + ORDER BY transyear, + month_no, + tpe"; + + break; + case 'Quarterly': + $sql = "SELECT QUARTER(debtortrans.trandate) as quarter_no, + YEAR(debtortrans.trandate) as transyear, + debtortrans.tpe, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) + as salesvalue, + SUM(CASE WHEN stockmoves.type=10 THEN + 1 ELSE 0 END) + as nooforders, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) + as returnvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves + INNER JOIN custbranch + ON stockmoves.debtorno=custbranch.debtorno + AND stockmoves.branchcode=custbranch.branchcode + INNER JOIN debtortrans + ON stockmoves.type=debtortrans.type + AND stockmoves.transno=debtortrans.transno + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND debtortrans.trandate>='" . $FromDate . "' + AND debtortrans.trandate<='" . $ToDate . "' + GROUP BY quarter_no, + transyear, + tpe + ORDER BY transyear, + quarter_no, + tpe"; + + break; + } + + $ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); + $SalesResult = DB_query($sql,$db,$ErrMsg); + + + echo '<table cellpadding=2 class="selection">'; + + echo'<tr> + <th>' . _('Period') . '</th> + <th>' . _('Sales') . '<br />' . _('Type') . '</th> + <th>' . _('No Orders') . '</th> + <th>' . _('Total Sales') . '</th> + <th>' . _('Refunds') . '</th> + <th>' . _('Net Sales') . '</th> + <th>' . _('Cost of Sales') . '</th> + <th>' . _('Gross Profit') . '</th> + </tr>'; + + $CumulativeTotalSales = 0; + $CumulativeTotalOrders = 0; + $CumulativeTotalRefunds = 0; + $CumulativeTotalNetSales = 0; + $CumulativeTotalCost = 0; + $CumulativeTotalGP = 0; + + $PrdTotalOrders =0; + $PrdTotalSales=0; + $PrdTotalRefunds=0; + $PrdTotalNetSales=0; + $PrdTotalCost=0; + $PrdTotalGP=0; + + $PeriodHeadingDone = false; + $LastPeriodHeading = 'First Run Through'; + $k=0; + while ($SalesRow=DB_fetch_array($SalesResult)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + switch ($_POST['DisplayData']){ + case 'Daily': + if ($LastPeriodHeading != ConvertSQLDate($SalesRow['trandate'])) { + $PeriodHeadingDone=false; + if ($LastPeriodHeading != 'First Run Through'){ //print the footer for the period + echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> + <td class="number">' . $PrdTotalOrders . '</td> + <td class="number">' . number_format($PrdTotalSales,2) . '</td> + <td class="number">' . number_format($PrdTotalRefunds,2) . '</td> + <td class="number">' . number_format($PrdTotalNetSales,2) . '</td> + <td class="number">' . number_format($PrdTotalCost,2) . '</td> + <td class="number">' . number_format($PrdTotalGP,2) . '</td> + </tr>'; + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + $PrdTotalOrders =0; + $PrdTotalSales=0; + $PrdTotalRefunds=0; + $PrdTotalNetSales=0; + $PrdTotalCost=0; + $PrdTotalGP=0; + } + } + if (! $PeriodHeadingDone){ + echo '<td>' . ConvertSQLDate($SalesRow['trandate']) . '</td>'; + $LastPeriodHeading = ConvertSQLDate($SalesRow['trandate']); + $PeriodHeadingDone = true; + } else { + echo '<td></td>'; + } + break; + case 'Weekly': + if ($LastPeriodHeading != _('wk'). '-' . $SalesRow['week_no'] . ' ' . $SalesRow['transyear']) { + $PeriodHeadingDone=false; + if ($LastPeriodHeading != 'First Run Through'){ + echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> + <td class="number">' . $PrdTotalOrders . '</td> + <td class="number">' . number_format($PrdTotalSales,2) . '</td> + <td class="number">' . number_format($PrdTotalRefunds,2) . '</td> + <td class="number">' . number_format($PrdTotalNetSales,2) . '</td> + <td class="number">' . number_format($PrdTotalCost,2) . '</td> + <td class="number">' . number_format($PrdTotalGP,2) . '</td> + </tr>'; + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + $PrdTotalOrders =0; + $PrdTotalSales=0; + $PrdTotalRefunds=0; + $PrdTotalNetSales=0; + $PrdTotalCost=0; + $PrdTotalGP=0; + } + } + if (! $PeriodHeadingDone){ + echo '<td>' . _('wk'). '-' . $SalesRow['week_no'] . ' ' . $SalesRow['transyear'] . '</td>'; + $LastPeriodHeading = _('wk'). '-' . $SalesRow['week_no'] . ' ' . $SalesRow['transyear']; + $PeriodHeadingDone = true; + } else { + echo '<td></td>'; + } + break; + case 'Monthly': + if ($LastPeriodHeading != $SalesRow['month_name'] . ' ' . $SalesRow['transyear']) { + $PeriodHeadingDone=false; + if ($LastPeriodHeading != 'First Run Through'){ + echo '<td colspan="2" class="number">' . _('Total') . '-' . $LastPeriodHeading . '</td> + <td class="number">' . $PrdTotalOrders . '</td> + <td class="number">' . number_format($PrdTotalSales,2) . '</td> + <td class="number">' . number_format($PrdTotalRefunds,2) . '</td> + <td class="number">' . number_format($PrdTotalNetSales,2) . '</td> + <td class="number">' . number_format($PrdTotalCost,2) . '</td> + <td class="number">' . number_format($PrdTotalGP,2) . '</td> + </tr>'; + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + $PrdTotalOrders =0; + $PrdTotalSales=0; + $PrdTotalRefunds=0; + $PrdTotalNetSales=0; + $PrdTotalCost=0; + $PrdTotalGP=0; + } + } + if (! $PeriodHeadingDone){ + echo '<td>' . $SalesRow['month_name'] . ' ' . $SalesRow['transyear'] . '</td>'; + $LastPeriodHeading = $SalesRow['month_name'] . ' ' . $SalesRow['transyear']; + $PeriodHeadingDone = true; + } else { + echo '<td></td>'; + } + break; + case 'Quarterly': + if ($LastPeriodHeading != _('Qtr'). '-' . $SalesRow['quarter_no'] . ' ' . $SalesRow['transyear']) { + $PeriodHeadingDone=false; + if ($LastPeriodHeading != 'First Run Through'){ + echo '<td colspan="2" class="number">' . _('Total') . '-'. $LastPeriodHeading . '</td> + <td class="number">' . $PrdTotalOrders . '</td> + <td class="number">' . number_format($PrdTotalSales,2) . '</td> + <td class="number">' . number_format($PrdTotalRefunds,2) . '</td> + <td class="number">' . number_format($PrdTotalNetSales,2) . '</td> + <td class="number">' . number_format($PrdTotalCost,2) . '</td> + <td class="number">' . number_format($PrdTotalGP,2) . '</td> + </tr>'; + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + $PrdTotalOrders =0; + $PrdTotalSales=0; + $PrdTotalRefunds=0; + $PrdTotalNetSales=0; + $PrdTotalCost=0; + $PrdTotalGP=0; + } + } + if (! $PeriodHeadingDone){ + echo '<td>' . _('Qtr'). '-' . $SalesRow['quarter_no'] . ' ' . $SalesRow['transyear'] . '</td>'; + $LastPeriodHeading = _('Qtr'). '-' . $SalesRow['quarter_no'] . ' ' . $SalesRow['transyear']; + $PeriodHeadingDone = true; + } else { + echo '<td></td>'; + } + break; + } + echo '<td>' . $SalesRow['tpe'] . '</td> + <td class="number">' . $SalesRow['nooforders'] . '</td> + <td class="number">' . number_format($SalesRow['salesvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['returnvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['cost'],2) . '</td> + <td class="number">' . number_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),2) . '</td> + </tr>'; + $PrdTotalOrders +=$SalesRow['nooforders']; + $PrdTotalSales += $SalesRow['salesvalue']; + $PrdTotalRefunds += $SalesRow['returnvalue']; + $PrdTotalNetSales += ($SalesRow['salesvalue']+$SalesRow['returnvalue']); + $PrdTotalCost += $SalesRow['cost']; + $PrdTotalGP += ($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']); + + $CumulativeTotalSales += $SalesRow['salesvalue']; + $CumulativeTotalOrders = $SalesRow['nooforders']; + $CumulativeTotalRefunds += $SalesRow['returnvalue']; + $CumulativeTotalNetSales += ($SalesRow['salesvalue']+$SalesRow['returnvalue']); + $CumulativeTotalCost += $SalesRow['cost']; + $CumulativeTotalGP += ($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']); + } + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + echo '<td colspan="2" class="number">' . _('Total') . ' ' . $LastPeriodHeading . '</td> + <td class="number">' . $PrdTotalOrders . '</td> + <td class="number">' . number_format($PrdTotalSales,2) . '</td> + <td class="number">' . number_format($PrdTotalRefunds,2) . '</td> + <td class="number">' . number_format($PrdTotalNetSales,2) . '</td> + <td class="number">' . number_format($PrdTotalCost,2) . '</td> + <td class="number">' . number_format($PrdTotalGP,2) . '</td> + </tr>'; + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + echo '<td colspan="2" class="number">' . _('GRAND Total') . '</td> + <td class="number">' . $CumulativeTotalOrders . '</td> + <td class="number">' . number_format($CumulativeTotalSales,2) . '</td> + <td class="number">' . number_format($CumulativeTotalRefunds,2) . '</td> + <td class="number">' . number_format($CumulativeTotalNetSales,2) . '</td> + <td class="number">' . number_format($CumulativeTotalCost,2) . '</td> + <td class="number">' . number_format($CumulativeTotalGP,2) . '</td> + </tr>'; + + echo '</table>'; + +} //end of if user hit show sales +include('includes/footer.inc'); +?> \ No newline at end of file Added: trunk/SalesCategoryPeriodInquiry.php =================================================================== --- trunk/SalesCategoryPeriodInquiry.php (rev 0) +++ trunk/SalesCategoryPeriodInquiry.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -0,0 +1,220 @@ +<?php + +/* $Id: SalesCategoryPeriodInquiry.php 4261 2010-12-22 15:56:50Z $*/ + +include('includes/session.inc'); +$title = _('Sales Category Report'); +include('includes/header.inc'); +include('includes/DefineCartClass.php'); + +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Category Report') . '</p>'; +echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br>'; + +if (!isset($_POST['DateRange'])){ + /* then assume report is for This Month - maybe wrong to do this but hey better than reporting an error?*/ + $_POST['DateRange']='ThisMonth'; +} + +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +echo '<table cellpadding=2 class="selection">'; + +echo '<tr><th colspan="2" class="centre">' . _('Date Selection') . '</th> + </tr> + <tr> + <td>' . _('Custom Range') . ':</td> + <td><input type="radio" name="DateRange" value="Custom" '; +if ($_POST['DateRange']=='Custom'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Week') . ':</td> + <td><input type="radio" name="DateRange" value="ThisWeek" '; +if ($_POST['DateRange']=='ThisWeek'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Month') . ':</td> + <td><input type="radio" name="DateRange" value="ThisMonth" '; +if ($_POST['DateRange']=='ThisMonth'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Quarter') . ':</td> + <td><input type="radio" name="DateRange" value="ThisQuarter" '; +if ($_POST['DateRange']=='ThisQuarter'){ + echo 'checked'; +} +echo '></td> + </tr>'; +if ($_POST['DateRange']=='Custom'){ + echo '<tr> + <td>' . _('Date From') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Date To') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> + </tr>'; +} +echo '</table>'; + + +echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '">'; +echo '</form></div>'; +echo '<br />'; + +if ($_POST['DateRange']=='Custom' AND !isset($_POST['FromDate']) AND !isset($_POST['ToDate'])){ + //Don't run the report until custom dates entered + unset($_POST['ShowSales']); +} + +if (isset($_POST['ShowSales'])){ + $InputError=0; //assume no input errors now test for errors + if ($_POST['DateRange']=='Custom'){ + if (!Is_Date($_POST['FromDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the from date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (!Is_Date($_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the to date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (Date1GreaterThanDate2($_POST['FromDate'],$_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The from date is expected to be a date prior to the to date. Please review the selected date range'),'error'); + } + } + switch ($_POST['DateRange']) { + case 'ThisWeek': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w')+1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisMonth': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisQuarter': + switch (date('m')) { + case 1: + case 2: + case 3: + $QuarterStartMonth=1; + break; + case 4: + case 5: + case 6: + $QuarterStartMonth=4; + break; + case 7: + case 8: + case 9: + $QuarterStartMonth=7; + break; + default: + $QuarterStartMonth=10; + } + $FromDate = date('Y-m-d',mktime(0,0,0,$QuarterStartMonth,1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'Custom': + $FromDate = FormatDateForSQL($_POST['FromDate']); + $ToDate = FormatDateForSQL($_POST['ToDate']); + } + $sql = "SELECT stockmaster.categoryid, + stockcategory.categorydescription, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) as salesvalue, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) as returnvalue, + SUM(CASE WHEN stockmoves.type=11 + OR stockmoves.type=10 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) as netsalesvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND trandate>='" . $FromDate . "' + AND trandate<='" . $ToDate . "' + GROUP BY stockmaster.categoryid + ORDER BY netsalesvalue DESC"; + + $ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); + $SalesResult = DB_query($sql,$db,$ErrMsg); + $OrdersResult = DB_query($OrdersSQL,$db,$ErrMsg); + + echo '<table cellpadding=2 class="selection">'; + + echo'<tr> + <th>' . _('Category') . '</th> + <th>' . _('Total Sales') . '</th> + <th>' . _('Refunds') . '</th> + <th>' . _('Net Sales') . '</th> + <th>' . _('Cost of Sales') . '</th> + <th>' . _('Gross Profit') . '</th> + </tr>'; + + $CumulativeTotalSales = 0; + $CumulativeTotalRefunds = 0; + $CumulativeTotalNetSales = 0; + $CumulativeTotalCost = 0; + $CumulativeTotalGP = 0; + + $k=0; + while ($SalesRow=DB_fetch_array($SalesResult)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + echo '<td>' . $SalesRow['categoryid'] . ' - ' . $SalesRow['categorydescription'] . '</td> + <td class="number">' . number_format($SalesRow['salesvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['returnvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['salesvalue']+$SalesRow['returnvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['cost'],2) . '</td> + <td class="number">' . number_format(($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']),2) . '</td> + </tr>'; + + $CumulativeTotalSales += $SalesRow['salesvalue']; + $CumulativeTotalRefunds += $SalesRow['returnvalue']; + $CumulativeTotalNetSales += ($SalesRow['salesvalue']+$SalesRow['returnvalue']); + $CumulativeTotalCost += $SalesRow['cost']; + $CumulativeTotalGP += ($SalesRow['salesvalue']+$SalesRow['returnvalue']-$SalesRow['cost']); + } //loop around category sales for the period + + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + echo '<td class="number">' . _('GRAND Total') . '</td> + <td class="number">' . number_format($CumulativeTotalSales,2) . '</td> + <td class="number">' . number_format($CumulativeTotalRefunds,2) . '</td> + <td class="number">' . number_format($CumulativeTotalNetSales,2) . '</td> + <td class="number">' . number_format($CumulativeTotalCost,2) . '</td> + <td class="number">' . number_format($CumulativeTotalGP,2) . '</td> + </tr>'; + + echo '</table>'; + +} //end of if user hit show sales +include('includes/footer.inc'); +?> \ No newline at end of file Modified: trunk/SalesGLPostings.php =================================================================== --- trunk/SalesGLPostings.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/SalesGLPostings.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -92,7 +92,7 @@ $ShowLivePostingRecords = true; - $SQL = 'SELECT salesglpostings.id, + $SQL = "SELECT salesglpostings.id, salesglpostings.area, salesglpostings.stkcat, salesglpostings.salestype, @@ -100,7 +100,7 @@ salesglpostings.discountglcode FROM salesglpostings LEFT JOIN chartmaster ON salesglpostings.salesglcode = chartmaster.accountcode - WHERE chartmaster.accountcode IS NULL'; + WHERE chartmaster.accountcode IS NULL"; $result = DB_query($SQL,$db); if (DB_num_rows($result)>0){ @@ -124,13 +124,13 @@ $k=1; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%sSelectedSalesPostingID=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedSalesPostingID=%s&delete=yes\">". _('Delete') . "</td></tr>", + <td><a href="%sSelectedSalesPostingID=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedSalesPostingID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales GL posting record?') . '\');">'. _('Delete') . '</td></tr>', $myrow[1], $myrow[2], $myrow[3], @@ -143,11 +143,11 @@ } } - $SQL = 'SELECT salesglpostings.id, + $SQL = "SELECT salesglpostings.id, salesglpostings.area, salesglpostings.stkcat, salesglpostings.salestype - FROM salesglpostings'; + FROM salesglpostings"; $result = DB_query($SQL,$db); @@ -203,7 +203,7 @@ } if ($ShowLivePostingRecords){ - $SQL = 'SELECT salesglpostings.id, + $SQL = "SELECT salesglpostings.id, salesglpostings.area, salesglpostings.stkcat, salesglpostings.salestype, @@ -213,12 +213,13 @@ chartmaster as chart1, chartmaster as chart2 WHERE salesglpostings.salesglcode = chart1.accountcode - AND salesglpostings.discountglcode = chart2.accountcode'; + AND salesglpostings.discountglcode = chart2.accountcode"; $result = DB_query($SQL,$db); - echo '<table class=selection>'; - echo '<tr><th>' . _('Area') . '</th> + echo '<table class=selection> + <tr> + <th>' . _('Area') . '</th> <th>' . _('Stock Category') . '</th> <th>' . _('Sales Type') . '</th> <th>' . _('Sales Account') . '</th> @@ -236,13 +237,13 @@ $k=1; } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href=\"%sSelectedSalesPostingID=%s\">" . _('Edit') . "</td> - <td><a href=\"%sSelectedSalesPostingID=%s&delete=yes\">". _('Delete') . "</td></tr>", + <td><a href="%sSelectedSalesPostingID=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedSalesPostingID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales GL posting record?') . '\');">'. _('Delete') . '</td></tr>', $myrow[1], $myrow[2], $myrow[3], @@ -296,21 +297,21 @@ } /*end of if $SelectedSalesPostingID only do the else when a new record is being entered */ - $SQL = 'SELECT areacode, - areadescription FROM areas'; + $SQL = "SELECT areacode, + areadescription FROM areas"; $result = DB_query($SQL,$db); - echo '<br /><table class=selection> + echo '<br /><table class="selection"> <tr> <td>' . _('Area') . ':</td> <td><select name="Area"> - <option VALUE="AN">' . _('Any Other') . '</option>'; + <option value="AN">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['Area']) and $myrow['areacode']==$_POST['Area']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['areacode'] . '">'. $myrow['areadescription'] . '</option>'; @@ -318,7 +319,7 @@ DB_free_result($result); - $SQL = 'SELECT categoryid, categorydescription FROM stockcategory'; + $SQL = "SELECT categoryid, categorydescription FROM stockcategory"; $result = DB_query($SQL,$db); echo '</select></td></tr>'; @@ -326,7 +327,7 @@ echo '<tr><td>' . _('Stock Category') . ':</td> <td><select name="StkCat"> - <option VALUE="ANY">' . _('Any Other') . '</option>'; + <option value="ANY">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { @@ -344,21 +345,21 @@ DB_free_result($result); - $SQL = 'SELECT typeabbrev, + $SQL = "SELECT typeabbrev, sales_type - FROM salestypes'; + FROM salestypes"; $result = DB_query($SQL,$db); echo '<tr><td>' . _('Sales Type') . ' / ' . _('Price List') . ':</td> <td><select name="SalesType">'; - echo '<option VALUE="AN">' . _('Any Other') . '</option>'; + echo '<option value="AN">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SalesType']) and $myrow['typeabbrev']==$_POST['SalesType']) { - echo '<option selected VALUE="'; + echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['typeabbrev'] . '">' . $myrow['sales_type'] . '</option>'; @@ -386,7 +387,7 @@ if (isset($_POST['SalesGLCode']) and $myrow['accountcode']==$_POST['SalesGLCode']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; @@ -404,7 +405,7 @@ } else { echo '<option value="'; } - echo $myrow['accountcode'] . "'>" . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; + echo $myrow['accountcode'] . '">' . $myrow['accountcode'] . ' - ' . $myrow['accountname'] . '</option>'; } //end while loop Added: trunk/SalesTopItemsInquiry.php =================================================================== --- trunk/SalesTopItemsInquiry.php (rev 0) +++ trunk/SalesTopItemsInquiry.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -0,0 +1,275 @@ +<?php + +/* $Id: SalesTopItemsInquiry.php 4261 2010-12-22 15:56:50Z $*/ + +include('includes/session.inc'); +$title = _('Sales Category Report'); +include('includes/header.inc'); +include('includes/DefineCartClass.php'); + +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Sales Report') . '" alt="" />' . ' ' . _('Sales Category Report') . '</p>'; +echo '<div class="page_help_text">' . _('Select the parameters for the report') . '</div><br>'; + +if (!isset($_POST['DateRange'])){ + /* then assume report is for This Month - maybe wrong to do this but hey better than reporting an error?*/ + $_POST['DateRange']='ThisMonth'; +} + +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; +echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + +echo '<table cellpadding=2 class="selection"> + <tr><td valign=top> + <table>'; + +echo '<tr><th colspan="2" class="centre">' . _('Date Selection') . '</th> + </tr> + <tr> + <td>' . _('Custom Range') . ':</td> + <td><input type="radio" name="DateRange" value="Custom" '; +if ($_POST['DateRange']=='Custom'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Week') . ':</td> + <td><input type="radio" name="DateRange" value="ThisWeek" '; +if ($_POST['DateRange']=='ThisWeek'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Month') . ':</td> + <td><input type="radio" name="DateRange" value="ThisMonth" '; +if ($_POST['DateRange']=='ThisMonth'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('This Quarter') . ':</td> + <td><input type="radio" name="DateRange" value="ThisQuarter" '; +if ($_POST['DateRange']=='ThisQuarter'){ + echo 'checked'; +} +echo '></td> + </tr>'; +if ($_POST['DateRange']=='Custom'){ + echo '<tr> + <td>' . _('Date From') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" value="' . $_POST['FromDate'] . '" /></td> + </tr>'; + echo '<tr> + <td>' . _('Date To') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> + </tr>'; +} +echo '</table></td> + <td valign=top> + <table>'; //new sub table to set parameters for order of display + + +if (!isset($_POST['OrderBy'])){ //default to order by net sales + $_POST['OrderBy']='NetSales'; +} +echo '<tr><th colspan="2" class="centre">' . _('Display') . '</th> + </tr> + <tr> + <td>' . _('Order By Net Sales') . ':</td> + <td><input type="radio" name="OrderBy" value="NetSales" '; +if ($_POST['OrderBy']=='NetSales'){ + echo 'checked'; +} +echo '></td> + </tr> + <tr> + <td>' . _('Order By Quantity') . ':</td> + <td><input type="radio" name="OrderBy" value="Quantity" '; +if ($_POST['OrderBy']=='Quantity'){ + echo 'checked'; +} +if (!isset($_POST['NoToDisplay'])){ + $_POST['NoToDisplay']=20; +} +echo '></td> + </tr> + <tr> + <td>' . _('Number to Display') . ':</td> + <td><input type="text class="number" name="NoToDisplay" size="4" maxlength="4" value="' . $_POST['NoToDisplay'] .'" ></td> + </tr> + </table> + </td></tr> + </table>'; + + +echo '<br /><div class="centre"><input tabindex=4 type=submit name="ShowSales" value="' . _('Show Sales') . '">'; +echo '</form></div>'; +echo '<br />'; + +if ($_POST['DateRange']=='Custom' AND !isset($_POST['FromDate']) AND !isset($_POST['ToDate'])){ + //Don't run the report until custom dates entered + unset($_POST['ShowSales']); +} + +if (isset($_POST['ShowSales'])){ + $InputError=0; //assume no input errors now test for errors + if ($_POST['DateRange']=='Custom'){ + if (!Is_Date($_POST['FromDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the from date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (!Is_Date($_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The date entered for the to date is not in the appropriate format. Dates must be entered in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + } + if (Date1GreaterThanDate2($_POST['FromDate'],$_POST['ToDate'])){ + $InputError = 1; + prnMsg(_('The from date is expected to be a date prior to the to date. Please review the selected date range'),'error'); + } + } + switch ($_POST['DateRange']) { + case 'ThisWeek': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),date('d')-date('w')+1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisMonth': + $FromDate = date('Y-m-d',mktime(0,0,0,date('m'),1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'ThisQuarter': + switch (date('m')) { + case 1: + case 2: + case 3: + $QuarterStartMonth=1; + break; + case 4: + case 5: + case 6: + $QuarterStartMonth=4; + break; + case 7: + case 8: + case 9: + $QuarterStartMonth=7; + break; + default: + $QuarterStartMonth=10; + } + $FromDate = date('Y-m-d',mktime(0,0,0,$QuarterStartMonth,1,date('Y'))); + $ToDate = date('Y-m-d'); + break; + case 'Custom': + $FromDate = FormatDateForSQL($_POST['FromDate']); + $ToDate = FormatDateForSQL($_POST['ToDate']); + } + $sql = "SELECT stockmaster.stockid, + stockmaster.description, + stockcategory.categorydescription, + SUM(CASE WHEN stockmoves.type=10 + OR stockmoves.type=11 THEN + -qty + ELSE 0 END) as salesquantity, + SUM(CASE WHEN stockmoves.type=10 THEN + price*(1-discountpercent)* -qty + ELSE 0 END) as salesvalue, + SUM(CASE WHEN stockmoves.type=11 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) as returnvalue, + SUM(CASE WHEN stockmoves.type=11 + OR stockmoves.type=10 THEN + price*(1-discountpercent)* (-qty) + ELSE 0 END) as netsalesvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves INNER JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + INNER JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 + AND trandate>='" . $FromDate . "' + AND trandate<='" . $ToDate . "' + GROUP BY stockmaster.stockid, + stockmaster.description, + stockcategory.categorydescription "; + + if ($_POST['OrderBy']=='NetSales'){ + $sql .= " ORDER BY netsalesvalue DESC "; + } else { + $sql .= " ORDER BY salesquantity DESC "; + } + if (is_numeric($_POST['NoToDisplay'])){ + if ($_POST['NoToDisplay'] > 0){ + $sql .= " LIMIT " . $_POST['NoToDisplay']; + } + } + + $ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); + $SalesResult = DB_query($sql,$db,$ErrMsg); + + + echo '<table cellpadding=2 class="selection">'; + + echo'<tr> + <th>' . _('Rank') . '</th> + <th>' . _('Item') . '</th> + <th>' . _('Category') . '</th> + <th>' . _('Sales Value') . '</th> + <th>' . _('Refunds') . '</th> + <th>' . _('Net Sales') . '</th> + <th>' . _('Sales') .'<br />' . _('Quantity') . '</th> + </tr>'; + + $CumulativeTotalSales = 0; + $CumulativeTotalRefunds = 0; + $CumulativeTotalNetSales = 0; + $CumulativeTotalQuantity = 0; + $i=1; + $k=0; + while ($SalesRow=DB_fetch_array($SalesResult)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + echo '<td>' . $i . '</td> + <td>' . $SalesRow['stockid'] . ' - ' . $SalesRow['description'] . '</td> + <td>' . $SalesRow['categorydescription'] . '</td> + <td class="number">' . number_format($SalesRow['salesvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['returnvalue'],2) . '</td> + <td class="number">' . number_format($SalesRow['netsalesvalue'],2) . '</td> + <td class="number">' . $SalesRow['salesquantity'] . '</td> + </tr>'; + $i++; + + $CumulativeTotalSales += $SalesRow['salesvalue']; + $CumulativeTotalRefunds += $SalesRow['returnvalue']; + $CumulativeTotalNetSales += ($SalesRow['salesvalue']+$SalesRow['returnvalue']); + $CumulativeTotalQuantity += $SalesRow['salesquantity']; + + } //loop around category sales for the period + + if ($k==1){ + echo '<tr class="EvenTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="OddTableRows">'; + } else { + echo '<tr class="OddTableRows"><td colspan="8"><hr></td></tr>'; + echo '<tr class="EvenTableRows">'; + } + echo '<td class="number" colspan=3>' . _('GRAND Total') . '</td> + <td class="number">' . number_format($CumulativeTotalSales,2) . '</td> + <td class="number">' . number_format($CumulativeTotalRefunds,2) . '</td> + <td class="number">' . number_format($CumulativeTotalNetSales,2) . '</td> + <td class="number">' . $CumulativeTotalQuantity . '</td> + </tr>'; + + echo '</table>'; + +} //end of if user hit show sales +include('includes/footer.inc'); +?> \ No newline at end of file Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/UpgradeDatabase.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -109,7 +109,9 @@ case '4.03RC2': case '4.03': case '4.03.2': + case '4.03.3': case '4.03.5': + case '4.03.6': case '4.03.7': $SQLScripts[] = './sql/mysql/upgrade3.11.1-4.00.sql'; case '4.03.8': Modified: trunk/build/make_release.sh =================================================================== --- trunk/build/make_release.sh 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/build/make_release.sh 2011-05-25 10:30:45 UTC (rev 4574) @@ -67,6 +67,8 @@ msgfmt -o locale/zh_HK.utf8/LC_MESSAGES/messages.mo locale/zh_HK.utf8/LC_MESSAGES/messages.po msgfmt -o locale/vi_VN.utf8/LC_MESSAGES/messages.mo locale/vi_VN.utf8/LC_MESSAGES/messages.po +mysql -u$MYSQL_USER -p$MYSQL_PWD < $BASE_DIR/build/TruncateAuditTrail.sql + echo "SET FOREIGN_KEY_CHECKS = 0;" > $BASE_DIR/sql/mysql/weberp-new.sql mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --create-options --skip-set-charset --ignore-table=weberpdemo.mrpsupplies --ignore-table=weberpdemo.mrpplanedorders --ignore-table=weberpdemo.mrpparameters --ignore-table=weberpdemo.levels --ignore-table=weberpdemo.mrprequirements --ignore-table=weberpdemo.audittrail --no-data weberpdemo >> $BASE_DIR/sql/mysql/weberp-new.sql @@ -118,7 +120,6 @@ echo "UPDATE systypes SET typeno=0;" >> $BASE_DIR/sql/mysql/weberp-new.sql echo "INSERT INTO shippers VALUES (1,'Default Shipper',0);" >> $BASE_DIR/sql/mysql/weberp-new.sql echo "UPDATE config SET confvalue='1' WHERE confname='Default_Shipper';" >> $BASE_DIR/sql/mysql/weberp-new.sql -echo "TRUNCATE TABLE audittrail;" >> $BASE_DIR/sql/mysql/weberp-demo.sql echo "SET FOREIGN_KEY_CHECKS = 1;" >> $BASE_DIR/sql/mysql/weberp-demo.sql rm $OUTPUT_DIR/webERP.zip Modified: trunk/config.distrib.php =================================================================== --- trunk/config.distrib.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/config.distrib.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -18,7 +18,7 @@ // The timezone of the business - this allows the possibility of having // the web-server on a overseas machine but record local time // this is not necessary if you have your own server locally -// putenv('TZ=Europe/London'); +putenv('TZ=Europe/London'); // putenv('TZ=Australia/Melbourne'); // putenv('TZ=Australia/Sydney'); // putenv('TZ=Pacific/Auckland'); @@ -86,8 +86,8 @@ if ($rootpath == "/" OR $rootpath == "\\") { $rootpath = ""; } -//$rootpath = '/web-erp'; + /* Report all errors except E_NOTICE This is the default value set in php.ini for most installations but just to be sure it is forced here turning on NOTICES destroys things */ @@ -95,4 +95,4 @@ error_reporting (E_ALL && ~E_NOTICE); /*Make sure there is nothing - not even spaces after this last ?> */ -?> +?> \ No newline at end of file Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/doc/Change.log 2011-05-25 10:30:45 UTC (rev 4574) @@ -1,5 +1,7 @@ webERP Change Log +25/5/11 New Sales Inquiry scripts by sales type/price list by category and top sellers +24/5/11 Updated from launchpad translations those that had changed from 18/4/11 including Viatnamese, Albanian, Russian, Spanish 23/5/11 Tim: Remove SystemCheck.php and code standards changes(launchpad 4711-4718) 23/5/11 Tim: Make link from SelectProduct.php to place purchase orders factor in the lead time into the delivery date in the purchase order (launchpad 4710) 23/5/11 Exson: fix PaymentMethods could not add new - comma missing in INSERT SQL Modified: trunk/doc/Manual/ManualContents.php =================================================================== --- trunk/doc/Manual/ManualContents.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/doc/Manual/ManualContents.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -21,7 +21,7 @@ -->';*/ $PathPrefix='../../'; -include($PathPrefix.'includes/session.inc'); +//include($PathPrefix.'includes/session.inc'); include('ManualHeader.html'); ?> Modified: trunk/index.php =================================================================== --- trunk/index.php 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/index.php 2011-05-25 10:30:45 UTC (rev 4574) @@ -188,6 +188,22 @@ </tr> <tr> <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/SalesByTypePeriodInquiry.php">' . _('Sales By Sales Type Inquiry') . '</a></p>'; ?> + </td> + </tr> + <tr> + <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/SalesCategoryPeriodInquiry.php">' . _('Sales By Category Inquiry') . '</a></p>'; ?> + </td> + </tr> + <tr> + <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/SalesTopItemsInquiry.php">' . _('Top Sellers Inquiry') . '</a></p>'; ?> + </td> + </tr> + + <tr> + <td class="menu_group_item"> <?php echo '<p>• <a href="' . $rootpath . '/PDFDeliveryDifferences.php">' . _('Order Delivery Differences Report') . '</a></p>'; ?> </td> </tr> Modified: trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.mo =================================================================== (Binary files differ) Modified: trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po =================================================================== --- trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po 2011-05-23 10:20:46 UTC (rev 4573) +++ trunk/locale/cs_CZ.utf8/LC_MESSAGES/messages.po 2011-05-25 10:30:45 UTC (rev 4574) @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: webERP 3.08\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-29 20:59+1200\n" +"POT-Creation-Date: 2011-05-24 21:53+1200\n" "PO-Revision-Date: 2011-02-07 15:33+0000\n" "Last-Translator: Tim Schofield <Unknown>\n" "Language-Team: Czech <cs...@li...>\n" @@ -21,7 +21,7 @@ "X-Poedit-Language: Czech\n" "X-Poedit-SourceCharset: utf-8\n" -#: AccountGroups.php:7 index.php:1275 +#: AccountGroups.php:7 index.php:1280 msgid "Account Groups" msgstr "Účetní skupiny" @@ -58,8 +58,8 @@ msgid "The account group name cannot contain the character" msgstr "Název účetní skupiny nemůže obsahovat znak" -#: AccountGroups.php:69 AccountSections.php:75 TaxCategories.php:33 -#: TaxProvinces.php:30 UnitsOfMeasure.php:30 +#: AccountGroups.php:69 TaxCategories.php:31 TaxProvinces.php:30 +#: UnitsOfMeasure.php:30 msgid "or the character" msgstr "nebo znak" @@ -101,7 +101,7 @@ msgid "The SQL that was used to update the account group was" msgstr "SQL, který byl použit k aktualizaci účtu skupina byla" -#: AccountGroups.php:137 AccountSections.php:106 PaymentMethods.php:90 +#: AccountGroups.php:137 AccountSections.php:104 PaymentMethods.php:82 msgid "Record Updated" msgstr "Záznam aktualizován" @@ -113,7 +113,7 @@ msgid "The SQL that was used to insert the account group was" msgstr "SQL, který byl použit pro vložení na účet skupina byla" -#: AccountGroups.php:157 AccountSections.php:118 PaymentMethods.php:114 +#: AccountGroups.php:157 AccountSections.php:116 PaymentMethods.php:106 msgid "Record inserted" msgstr "Záznam vložen" @@ -129,24 +129,24 @@ "Nelze smazat tento účet skupiny, protože účtů hlavní knihy byly vytvořeny " "pomocí této skupině" -#: AccountGroups.php:180 AccountGroups.php:190 AccountSections.php:139 -#: Areas.php:117 Areas.php:126 BankAccounts.php:163 CreditStatus.php:126 -#: Currencies.php:144 Currencies.php:152 Currencies.php:159 +#: AccountGroups.php:180 AccountGroups.php:190 AccountSections.php:137 +#: Areas.php:116 Areas.php:125 BankAccounts.php:157 CreditStatus.php:125 +#: Currencies.php:143 Currencies.php:151 Currencies.php:158 #: CustomerBranches.php:286 CustomerBranches.php:296 CustomerBranches.php:306 #: CustomerBranches.php:316 Customers.php:311 Customers.php:320 #: Customers.php:328 Customers.php:336 CustomerTypes.php:147 -#: CustomerTypes.php:157 Factors.php:136 FixedAssetCategories.php:131 +#: CustomerTypes.php:157 Factors.php:134 FixedAssetCategories.php:130 #: GLAccounts.php:80 GLAccounts.php:94 Locations.php:244 Locations.php:252 #: Locations.php:261 Locations.php:269 Locations.php:277 Locations.php:285 #: Locations.php:293 Locations.php:301 MRPDemandTypes.php:87 -#: PaymentMethods.php:148 PaymentTerms.php:147 PaymentTerms.php:154 -#: PcExpenses.php:128 SalesCategories.php:127 SalesCategories.php:135 -#: SalesPeople.php:144 SalesPeople.php:151 SalesTypes.php:147 -#: SalesTypes.php:157 Shippers.php:82 Shippers.php:94 StockCategories.php:179 +#: PaymentMethods.php:140 PaymentTerms.php:147 PaymentTerms.php:154 +#: PcExpenses.php:152 SalesCategories.php:125 SalesCategories.php:133 +#: SalesPeople.php:144 SalesPeople.php:151 SalesTypes.php:145 +#: SalesTypes.php:155 Shippers.php:82 Shippers.php:94 StockCategories.php:179 #: Stocks.php:475 Stocks.php:484 Stocks.php:492 Stocks.php:500 Stocks.php:508 #: Stocks.php:516 Suppliers.php:609 Suppliers.php:618 Suppliers.php:626 -#: SupplierTypes.php:145 TaxCategories.php:133 TaxGroups.php:127 -#: TaxGroups.php:134 TaxProvinces.php:125 UnitsOfMeasure.php:137 +#: SupplierTypes.php:145 TaxCategories.php:131 TaxGroups.php:127 +#: TaxGroups.php:134 TaxProvinces.php:125 UnitsOfMeasure.php:138 #: WorkCentres.php:89 WorkCentres.php:95 WWW_Access.php:83 msgid "There are" msgstr "Jsou zde" @@ -192,35 +192,36 @@ msgid "Could not get account groups because" msgstr "Nemohu získat účetní sk... [truncated message content] |
From: <dai...@us...> - 2011-05-23 10:20:54
|
Revision: 4573 http://web-erp.svn.sourceforge.net/web-erp/?rev=4573&view=rev Author: daintree Date: 2011-05-23 10:20:46 +0000 (Mon, 23 May 2011) Log Message: ----------- remove .bzrignore Removed Paths: ------------- trunk/.bzrignore Deleted: trunk/.bzrignore =================================================================== --- trunk/.bzrignore 2011-05-23 10:14:06 UTC (rev 4572) +++ trunk/.bzrignore 2011-05-23 10:20:46 UTC (rev 4573) @@ -1,4 +0,0 @@ -.krk -.bzrignore -geany_run_script.sh -companies/weberpdemo/reportwriter/graph.png This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-23 10:20:53
|
Revision: 4573 http://web-erp.svn.sourceforge.net/web-erp/?rev=4573&view=rev Author: daintree Date: 2011-05-23 10:20:46 +0000 (Mon, 23 May 2011) Log Message: ----------- remove .bzrignore Removed Paths: ------------- trunk/.bzrignore Deleted: trunk/.bzrignore =================================================================== --- trunk/.bzrignore 2011-05-23 10:14:06 UTC (rev 4572) +++ trunk/.bzrignore 2011-05-23 10:20:46 UTC (rev 4573) @@ -1,4 +0,0 @@ -.krk -.bzrignore -geany_run_script.sh -companies/weberpdemo/reportwriter/graph.png This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-23 10:14:15
|
Revision: 4572 http://web-erp.svn.sourceforge.net/web-erp/?rev=4572&view=rev Author: daintree Date: 2011-05-23 10:14:06 +0000 (Mon, 23 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/Areas.php trunk/AuditTrail.php trunk/BankMatching.php trunk/BankReconciliation.php trunk/ContractBOM.php trunk/CreditStatus.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/CustomerReceipt.php trunk/DailySalesInquiry.php trunk/FTP_RadioBeacon.php trunk/FreightCosts.php trunk/GLTransInquiry.php trunk/GoodsReceived.php trunk/PO_Header.php trunk/PO_Items.php trunk/PO_SelectOSPurchOrder.php trunk/PaymentMethods.php trunk/PaymentTerms.php trunk/SelectProduct.php trunk/StockQties_csv.php trunk/SuppInvGRNs.php trunk/SuppTransGLAnalysis.php trunk/SupplierAllocations.php trunk/SupplierInvoice.php trunk/UpgradeDatabase.php trunk/WWW_Access.php trunk/doc/Change.log trunk/includes/DefinePOClass.php trunk/includes/DefineSuppAllocsClass.php trunk/includes/DefineSuppTransClass.php trunk/includes/PO_ReadInOrder.inc trunk/includes/footer.inc trunk/index.php Removed Paths: ------------- trunk/SystemCheck.php Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/Areas.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -1,7 +1,6 @@ <?php -/* $Revision: 1.22 $ */ + /* $Id$*/ -//$PageSecurity = 3; include('includes/session.inc'); @@ -163,7 +162,7 @@ echo '<td>' . $myrow[0] . '</td> <td>' . $myrow[1] . '</td>'; echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '&delete=yes">' . _('Delete') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales area?') . '\');">' . _('Delete') . '</a></td>'; echo '<td><a href="SelectCustomer.php'. '?Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; } //END WHILE LIST LOOP Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/AuditTrail.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -30,7 +30,7 @@ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class=selection>'; +echo '<table class="selection">'; echo '<tr><td>'. _('From Date') . ' ' . $_SESSION['DefaultDateFormat'] .'</td> <td><input tabindex="1" type=text class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="FromDate" size="11" maxlength="10" value=' .$_POST['FromDate'].'></td></tr>'; @@ -40,7 +40,7 @@ // Show user selections echo '<tr><td>'. _('User ID'). '</td> <td><select tabindex="3" name="SelectedUser">'; -echo '<option value="ALL">' . _('ALL') . '</option>'; +echo '<option value="ALL">' . _('All') . '</option>'; while ($users = DB_fetch_row($UserResult)) { if (isset($_POST['SelectedUser']) and $users[0]==$_POST['SelectedUser']) { echo '<option selected value="' . $users[0] . '">' . $users[0] . '</option>'; @@ -53,7 +53,7 @@ // Show table selections echo '<tr><td>'. _('Table '). '</td> <td><select tabindex="4" name="SelectedTable">'; -echo '<option value="ALL">' . _('ALL') . '</option>'; +echo '<option value="ALL">' . _('All') . '</option>'; while ($tables = DB_fetch_row($TableResult)) { if (isset($_POST['SelectedTable']) and $tables[0]==$_POST['SelectedTable']) { echo '<option selected value=' . $tables[0] . '>' . $tables[0] . '</option>'; @@ -176,7 +176,7 @@ for ($i=1; $i<sizeof($_SESSION['SQLString']['fields']); $i++) { if (isset($_SESSION['SQLString']['values'][$i]) and (trim(str_replace("'","",$_SESSION['SQLString']['values'][$i])) != "") & (trim($_SESSION['SQLString']['fields'][$i]) != 'password') & - (trim($_SESSION['SQLString']['fields'][$i]) != "www_users.password")) { + (trim($_SESSION['SQLString']['fields'][$i]) != 'www_users.password')) { echo '<tr bgcolor="' . $RowColour . '">'; echo '<td></td> <td></td> Modified: trunk/BankMatching.php =================================================================== --- trunk/BankMatching.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/BankMatching.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -1,10 +1,8 @@ <?php -/* $Revision: 1.23 $ */ + /* $Id$*/ -//$PageSecurity = 7; - -include("includes/session.inc"); +include('includes/session.inc'); $title = _('Bank Account Matching'); include('includes/header.inc'); @@ -29,9 +27,16 @@ exit; } +if (isset($_GET['Account'])) { + $_POST['BankAccount']=$_GET['Account']; + $_POST['ShowTransactions']=true; + $_POST['Ostg_or_All']='Ostg'; + $_POST['First20_or_All']='All'; +} + if (isset($_POST['Update']) AND $_POST['RowCounter']>1){ for ($Counter=1;$Counter <= $_POST['RowCounter']; $Counter++){ - if (isset($_POST["Clear_" . $Counter]) and $_POST["Clear_" . $Counter]==True){ + if (isset($_POST['Clear_' . $Counter]) AND $_POST['Clear_' . $Counter]==True){ /*Get amount to be cleared */ $sql = "SELECT amount, exrate @@ -79,13 +84,13 @@ echo '<table class=selection><tr>'; echo '<td align=left>' . _('Bank Account') . ':</td><td colspan=3><select tabindex="1" name="BankAccount">'; -$sql = 'SELECT accountcode, bankaccountname FROM bankaccounts'; +$sql = "SELECT accountcode, bankaccountname FROM bankaccounts"; $resultBankActs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultBankActs)){ if (isset($_POST['BankAccount']) and $myrow['accountcode']==$_POST['BankAccount']){ - echo "<option selected Value='" . $myrow['accountcode'] . "'>" . $myrow['bankaccountname']; + echo '<option selected value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . '</option>'; } else { - echo "<option Value='" . $myrow['accountcode'] . "'>" . $myrow['bankaccountname']; + echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . '</option>'; } } @@ -95,12 +100,12 @@ $_POST['BeforeDate'] = Date($_SESSION['DefaultDateFormat']); } if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ - $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date("m")-3,Date("d"),Date("y"))); + $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-3,Date('d'),Date('y'))); } // Change to allow input of FROM DATE and then TO DATE, instead of previous back-to-front method, add datepicker echo '<tr><td>' . _('Show') . ' ' . $TypeName . ' ' . _('from') . ':</td> - <td><input tabindex="3" type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="10" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" Value="' . $_POST['AfterDate'] . '"></td></tr>'; + <td><input tabindex="3" type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="10" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_POST['AfterDate'] . '"></td></tr>'; echo '<td>' . _('to') . ':</td> <td><input tabindex="2" type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="10" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" Value="' . $_POST['BeforeDate'] . '"></td>'; @@ -108,29 +113,29 @@ <td><select tabindex="4" name="Ostg_or_All">'; if ($_POST['Ostg_or_All']=='All'){ - echo '<option selected Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option Value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only'); + echo '<option selected value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only') . '</option>'; } else { - echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option selected Value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only'); + echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option selected Value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only') . '</option>'; } echo '</select></td></tr>'; echo '<tr><td colspan=3>' . _('Choose to display only the first 20 matching') . ' ' . $TypeName . ' ' . _('or all') . ' ' . $TypeName . ' ' . _('meeting the criteria') . ':</td><td><select tabindex="5" name="First20_or_All">'; if ($_POST['First20_or_All']=='All'){ - echo '<option selected Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option Value="First20">' . _('Show only the first 20') . ' ' . $TypeName; + echo '<option selected Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option Value="First20">' . _('Show only the first 20') . ' ' . $TypeName . '</option>'; } else { - echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option selected Value="First20">' . _('Show only the first 20') . ' ' . $TypeName; + echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option selected Value="First20">' . _('Show only the first 20') . ' ' . $TypeName . '</option>'; } echo '</select></td></tr>'; echo '</table><br><div class="centre"><input tabindex="6" type=submit name="ShowTransactions" VALUE="' . _('Show selected') . ' ' . $TypeName . '">'; -echo "<p><a href='$rootpath/BankReconciliation.php?" . SID . "'>" . _('Show reconciliation') . '</a></div>'; -echo '<hr>'; +echo '<p><a href="' . $rootpath . '/BankReconciliation.php">' . _('Show reconciliation') . '</a></div>'; +echo '<hr />'; $InputError=0; if (!Is_Date($_POST['BeforeDate'])){ @@ -151,7 +156,7 @@ $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); - if ($_POST["Ostg_or_All"]=='All'){ + if ($_POST['Ostg_or_All']=='All'){ if ($Type=='Payments'){ $sql = "SELECT banktransid, ref, @@ -163,7 +168,7 @@ WHERE amount <0 AND transdate >= '". $SQLAfterDate . "' AND transdate <= '" . $SQLBeforeDate . "' - AND bankact='" .$_POST["BankAccount"] . "' + AND bankact='" .$_POST['BankAccount'] . "' ORDER BY transdate"; } else { /* Type must == Receipts */ @@ -192,7 +197,7 @@ WHERE amount <0 AND transdate >= '". $SQLAfterDate . "' AND transdate <= '" . $SQLBeforeDate . "' - AND bankact=" .$_POST["BankAccount"] . " + AND bankact=" .$_POST['BankAccount'] . " AND ABS(amountcleared - (amount / exrate)) > 0.009 ORDER BY transdate"; } else { /* Type must == Receipts */ @@ -206,12 +211,12 @@ WHERE amount >0 AND transdate >= '". $SQLAfterDate . "' AND transdate <= '" . $SQLBeforeDate . "' - AND bankact='" .$_POST["BankAccount"] . "' + AND bankact='" .$_POST['BankAccount'] . "' AND ABS(amountcleared - (amount / exrate)) > 0.009 ORDER BY transdate"; } } - if ($_POST["First20_or_All"]!='All'){ + if ($_POST['First20_or_All']!='All'){ $sql = $sql . " LIMIT 20"; } @@ -219,13 +224,13 @@ $PaymentsResult = DB_query($sql, $db, $ErrMsg); $TableHeader = '<tr><th>'. _('Ref'). '</th> - <th>' . $TypeName . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Amount') . '</th> - <th>' . _('Outstanding') . '</th> - <th colspan=3>' . _('Clear') . ' / ' . _('Unclear') . '</th> - </tr>'; - echo '<table cellpadding=2 class=selection>' . $TableHeader; + <th>' . $TypeName . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Outstanding') . '</th> + <th colspan=3>' . _('Clear') . ' / ' . _('Unclear') . '</th> + </tr>'; + echo '<table cellpadding=2 class="selection">' . $TableHeader; $j = 1; //page length counter @@ -238,24 +243,23 @@ $Outstanding = $myrow['amt']- $myrow['amountcleared']; if (ABS($Outstanding)<0.009){ /*the payment is cleared dont show the check box*/ - printf("<tr bgcolor='#CCCEEE'> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td colspan=2>%s</td> - <td><input type='checkbox' name='Unclear_%s'><input type=hidden name='BankTrans_%s' VALUE=%s></td> - </tr>", - $myrow['ref'], - $myrow['banktranstype'], - $DisplayTranDate, - number_format($myrow['amt'],2), - number_format($Outstanding,2), - _('Unclear'), - $i, - $i, - $myrow['banktransid']); + pprintf('<tr bgcolor="#CCCEEE"> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td colspan=2>%s</td> + <td><input type="checkbox" name="Unclear_%s"><input type="hidden" name="BankTrans_%s" value=%s></td> + </tr>', + $myrow['ref'], + $myrow['banktranstype'], + $DisplayTranDate, + number_format($myrow['amt'],2), + number_format($Outstanding,2), + _('Unclear'), + $i, + $i, + $myrow['banktransid']); } else{ if ($k==1){ @@ -265,15 +269,14 @@ echo '<tr class="OddTableRows">'; $k=1; } - - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td><input type='checkbox' name='Clear_%s'><input type=hidden name='BankTrans_%s' VALUE=%s></td> - <td colspan=2><input type='text' maxlength=15 size=15 class=number name='AmtClear_%s'></td> - </tr>", + <td><input type="checkbox" name="Clear_%s"><input type=hidden name="BankTrans_%s" value=%s></td> + <td colspan=2><input type="text" maxlength=15 size=15 class="number" name="AmtClear_%s"></td> + </tr>', $myrow['ref'], $myrow['banktranstype'], $DisplayTranDate, @@ -296,10 +299,11 @@ } //end of while loop - echo '</table><br><div class="centre"><input type=hidden name="RowCounter" value=' . $i . '><input type=submit name="Update" VALUE="' . _('Update Matching') . '"></div>'; - + echo '</table> + <br /> + <div class="centre"><input type=hidden name="RowCounter" value=' . $i . '> + <input type=submit name="Update" value="' . _('Update Matching') . '"></div>'; } - echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/BankReconciliation.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -1,29 +1,33 @@ <?php -/* $Revision: 1.15 $ */ /* $Id$*/ -//$PageSecurity = 7; - include ('includes/session.inc'); $title = _('Bank Reconciliation'); include('includes/header.inc'); -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; +if (isset($_GET['Account'])) { + $_POST['BankAccount']=$_GET['Account']; + $_POST['ShowRec']=true; +} + if (isset($_POST['PostExchangeDifference']) and is_numeric($_POST['DoExchangeDifference'])){ - if (!is_numeric($_POST['BankStatmentBalance'])){ + if (!is_numeric($_POST['BankStatementBalance'])){ prnMsg(_('The entry in the bank statement balance is not numeric. The balance on the bank statement should be entered. The exchange difference has not been calculated and no general ledger journal has been created'),'warn'); - echo '<p>' . $_POST['BankStatmentBalance']; + echo '<p>' . $_POST['BankStatementBalance']; } else { /* Now need to get the currency of the account and the current table ex rate */ - $SQL = "SELECT rate, bankaccountname - FROM bankaccounts INNER JOIN currencies - ON bankaccounts.currcode=currencies.currabrev + $SQL = "SELECT rate, + bankaccountname + FROM bankaccounts INNER JOIN currencies + ON bankaccounts.currcode=currencies.currabrev WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; $ErrMsg = _('Could not retrieve the exchange rate for the selected bank account'); @@ -33,7 +37,7 @@ $BankAccountName = $CurrencyRow[1]; $CalculatedBalance = $_POST['DoExchangeDifference']; - $ExchangeDifference = ($CalculatedBalance - $_POST['BankStatmentBalance'])/$ExRate; + $ExchangeDifference = ($CalculatedBalance - $_POST['BankStatementBalance'])/$ExRate; include ('includes/SQL_CommonFunctions.inc'); $ExDiffTransNo = GetNextTransNo(36,$db); @@ -84,20 +88,22 @@ } //end if the bank statement balance was numeric } +echo '<table class="selection">'; +$SQL = "SELECT bankaccountname, accountcode FROM bankaccounts"; -echo '<table>'; - -$SQL = 'SELECT bankaccountname, accountcode FROM bankaccounts'; - $ErrMsg = _('The bank accounts could not be retrieved by the SQL because'); $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); -echo '<tr><td>' . _('Bank Account') . ':</td><td><select tabindex="1" name="BankAccount">'; +echo '<tr><td>' . _('Bank Account') . ':</td> + <td><select tabindex="1" name="BankAccount">'; if (DB_num_rows($AccountsResults)==0){ - echo '</select></td></tr></table><p>' . _('Bank Accounts have not yet been defined') . '. ' . _('You must first') . "<a href='" . $rootpath . "/BankAccounts.php'>" . _('define the bank accounts') . '</a>' . ' ' . _('and general ledger accounts to be affected') . '.'; + echo '</select></td> + </tr> + </table> + <p>' . _('Bank Accounts have not yet been defined') . '. ' . _('You must first') . '<a href="' . $rootpath . '/BankAccounts.php">' . _('define the bank accounts') . '</a>' . ' ' . _('and general ledger accounts to be affected') . '.'; include('includes/footer.inc'); exit; } else { @@ -116,20 +122,24 @@ include ('includes/GLPostings.inc'); -echo '</table><p><div class="centre"><input type=submit tabindex="2" name="ShowRec" value="' . _('Show bank reconciliation statement') . '"></div><br>'; +echo '</table><p><div class="centre"><input type=submit tabindex="2" name="ShowRec" value="' . _('Show bank reconciliation statement') . '"></div><br />'; if (isset($_POST['ShowRec']) OR isset($_POST['DoExchangeDifference'])){ /*Get the balance of the bank account concerned */ - $sql = "SELECT MAX(period) FROM chartdetails WHERE accountcode='" . $_POST['BankAccount']."'"; + $sql = "SELECT MAX(period) + FROM chartdetails + WHERE accountcode='" . $_POST['BankAccount']."'"; $PrdResult = DB_query($sql, $db); $myrow = DB_fetch_row($PrdResult); $LastPeriod = $myrow[0]; $SQL = "SELECT bfwd+actual AS balance - FROM chartdetails WHERE period='" . $LastPeriod . "' AND accountcode='" . $_POST['BankAccount']."'"; + FROM chartdetails + WHERE period='" . $LastPeriod . "' + AND accountcode='" . $_POST['BankAccount']."'"; $ErrMsg = _('The bank account balance could not be returned by the SQL because'); $BalanceResult = DB_query($SQL,$db,$ErrMsg); @@ -141,9 +151,9 @@ $SQL = "SELECT rate, bankaccounts.currcode, bankaccounts.bankaccountname - FROM bankaccounts INNER JOIN currencies - ON bankaccounts.currcode=currencies.currabrev - WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; + FROM bankaccounts INNER JOIN currencies + ON bankaccounts.currcode=currencies.currabrev + WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; $ErrMsg = _('Could not retrieve the currency and exchange rate for the selected bank account'); $CurrencyResult = DB_query($SQL,$db); $CurrencyRow = DB_fetch_row($CurrencyResult); @@ -151,13 +161,13 @@ $BankCurrCode = $CurrencyRow[1]; $BankAccountName = $CurrencyRow[2]; - echo '<table class=selection> - <tr class=EvenTableRows><td colspan=6><b>' . $BankAccountName . ' ' . _('Balance as at') . ' ' . Date($_SESSION['DefaultDateFormat']); + echo '<table class="selection"> + <tr class="EvenTableRows"><td colspan=6><b>' . $BankAccountName . ' ' . _('Balance as at') . ' ' . Date($_SESSION['DefaultDateFormat']); if ($_SESSION['CompanyRecord']['currencydefault']!=$BankCurrCode){ echo ' (' . $BankCurrCode . ' @ ' . $ExRate .')'; } echo '</b></td> - <td valign=bottom class=number><b>' . number_format($Balance*$ExRate,2) . '</b></td></tr>'; + <td valign=bottom class="number"><b>' . number_format($Balance*$ExRate,2) . '</b></td></tr>'; $SQL = "SELECT amount/exrate AS amt, amountcleared, @@ -181,13 +191,13 @@ echo '<tr><td colspan=6><b>' . _('Add back unpresented cheques') . ':</b></td></tr>'; $TableHeader = '<tr> - <th>' . _('Date') . '</th> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Orig Amount') . '</th> - <th>' . _('Outstanding') . '</th> - </tr>'; + <th>' . _('Date') . '</th> + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Orig Amount') . '</th> + <th>' . _('Outstanding') . '</th> + </tr>'; echo $TableHeader; @@ -307,7 +317,7 @@ if (isset($_POST['DoExchangeDifference'])){ echo '<input type="hidden" name="DoExchangeDifference" value=' . $FXStatementBalance . '>'; echo '<tr><td colspan=6>' . _('Enter the actual bank statement balance') . ' (' . $BankCurrCode . ')</b></td> - <td class=number><input type="text" name="BankStatmentBalance" maxlength=15 size=15 value=' . $_POST['BankStatmentBalance'] . '><td></tr>'; + <td class=number><input type="text" name="BankStatementBalance" maxlength=15 size=15 value=' . $_POST['BankStatementBalance'] . '><td></tr>'; echo '<tr><td colspan=7 align="center"><input type="submit" name="PostExchangeDifference" value="' . _('Calculate and Post Exchange Difference') . '" onclick="return confirm(\'' . _('This will create a general ledger journal to write off the exchange difference in the current balance of the account. It is important that the exchange rate above reflects the current value of the bank account currency') . ' - ' . _('Are You Sure?') . '\');"></td></tr>'; } @@ -323,8 +333,15 @@ echo '</table>'; } -echo '<p><div class="centre"><a tabindex="4" href="' . $rootpath . '/BankMatching.php?' . SID . '&Type=Payments">' . _('Match off cleared payments') . '</a>'; -echo '<br><a tabindex="5" href="' . $rootpath . '/BankMatching.php?' . SID . '&Type=Receipts">' . _('Match off cleared deposits') . '</a></div>'; + +if (isset($_POST['BankAccount'])) { + echo '<p><div class="centre"><a tabindex="4" href="' . $rootpath . '/BankMatching.php?Type=Payments&Account='.$_POST['BankAccount'].'">' . _('Match off cleared payments') . '</a>'; + echo '<br /><a tabindex="5" href="' . $rootpath . '/BankMatching.php?Type=Receipts&Account='.$_POST['BankAccount'].'">' . _('Match off cleared deposits') . '</a></div>'; +} else { + echo '<p><div class="centre"><a tabindex="4" href="' . $rootpath . '/BankMatching.php?Type=Payments">' . _('Match off cleared payments') . '</a>'; + echo '<br /><a tabindex="5" href="' . $rootpath . '/BankMatching.php?Type=Receipts">' . _('Match off cleared deposits') . '</a></div>'; +} + echo '</form>'; include('includes/footer.inc'); ?> Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/ContractBOM.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -290,11 +290,11 @@ $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Search For Stock Items') . '</p>'; - echo '<table class="selection"><tr>'; + echo '<table class="selection"> + <tr></tr> + <tr><td><select name="StockCat">'; - echo ':</tr><tr><td><select name="StockCat">'; - - echo '<option selected="True" value="All">' . _('All').'</option>'; + echo '<option selected="true" value="All">' . _('All').'</option>'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $_POST['StockCat']==$myrow1['categoryid']){ echo '<option selected value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>'; Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/CreditStatus.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -214,14 +214,15 @@ echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '">'; echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '">'; - echo '<table class="selection"><tr><td>'. _('Status Code') .':</td><td>'; - echo $_POST['ReasonCode'] . '</td></tr>'; + echo '<table class="selection"> + <tr><td>'. _('Status Code') .':</td> + <td>' . $_POST['ReasonCode'] . '</td></tr>'; } else { //end of if $SelectedReason only do the else when a new record is being entered if (!isset($_POST['ReasonCode'])) { $_POST['ReasonCode'] = ''; } - echo '<br><table class=selection> + echo '<br /><table class="selection"> <tr> <td>'. _('Status Code') .':</td> <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size=3 maxlength=2></td> Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/CustomerBranches.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -396,8 +396,7 @@ <td>%s</td> <td>%s</td> <td><a href="%s?DebtorNo=%s&SelectedBranch=%s">%s</td> - <td><a href="%s?DebtorNo=%s&SelectedBranch=%s&delete=yes" onclick=\'return confirm("' . - _('Are you sure you wish to delete this branch?') . '");\'>%s</td></tr>', + <td><a href="%s?DebtorNo=%s&SelectedBranch=%s&delete=yes" onclick=\'return confirm("' . _('Are you sure you wish to delete this branch?') . '");\'>%s</td></tr>', $myrow[10], $myrow[2], $myrow[5], @@ -590,42 +589,42 @@ exit; } - echo '<input type=hidden name="DebtorNo" value="'. $DebtorNo . '">'; + echo '<input type=hidden name="DebtorNo" value="'. $DebtorNo . '" />'; echo '<tr><td>'._('Branch Name').':</td>'; if (!isset($_POST['BrName'])) {$_POST['BrName']='';} - echo '<td><input tabindex=2 type="Text" name="BrName" size=41 maxlength=40 value="'. $_POST['BrName'].'"></td></tr>'; + echo '<td><input tabindex=2 type="text" name="BrName" size=41 maxlength=40 value="'. $_POST['BrName'].'"></td></tr>'; echo '<tr><td>'._('Branch Contact').':</td>'; if (!isset($_POST['ContactName'])) {$_POST['ContactName']='';} - echo '<td><input tabindex=3 type="Text" name="ContactName" size=41 maxlength=40 value="'. $_POST['ContactName'].'"></td></tr>'; + echo '<td><input tabindex=3 type="text" name="ContactName" size=41 maxlength=40 value="'. $_POST['ContactName'].'"></td></tr>'; echo '<tr><td>'._('Street Address 1 (Street)').':</td>'; if (!isset($_POST['BrAddress1'])) {$_POST['BrAddress1']='';} - echo '<td><input tabindex=4 type="Text" name="BrAddress1" size=41 maxlength=40 value="'. $_POST['BrAddress1'].'"></td></tr>'; + echo '<td><input tabindex=4 type="text" name="BrAddress1" size=41 maxlength=40 value="'. $_POST['BrAddress1'].'"></td></tr>'; echo '<tr><td>'._('Street Address 2 (Suburb/City)').':</td>'; if (!isset($_POST['BrAddress2'])) {$_POST['BrAddress2']='';} - echo '<td><input tabindex=5 type="Text" name="BrAddress2" size=41 maxlength=40 value="'. $_POST['BrAddress2'].'"></td></tr>'; + echo '<td><input tabindex=5 type="text" name="BrAddress2" size=41 maxlength=40 value="'. $_POST['BrAddress2'].'"></td></tr>'; echo '<tr><td>'._('Street Address 3 (State)').':</td>'; if (!isset($_POST['BrAddress3'])) {$_POST['BrAddress3']='';} - echo '<td><input tabindex=6 type="Text" name="BrAddress3" size=41 maxlength=40 value="'. $_POST['BrAddress3'].'"></td></tr>'; + echo '<td><input tabindex=6 type="text" name="BrAddress3" size=41 maxlength=40 value="'. $_POST['BrAddress3'].'"></td></tr>'; echo '<tr><td>'._('Street Address 4 (Postal Code)').':</td>'; if (!isset($_POST['BrAddress4'])) {$_POST['BrAddress4']='';} - echo '<td><input tabindex=7 type="Text" name="BrAddress4" size=31 maxlength=40 value="'. $_POST['BrAddress4'].'"></td></tr>'; + echo '<td><input tabindex=7 type="text" name="BrAddress4" size=31 maxlength=40 value="'. $_POST['BrAddress4'].'"></td></tr>'; echo '<tr><td>'._('Street Address 5').':</td>'; if (!isset($_POST['BrAddress5'])) {$_POST['BrAddress5']='';} - echo '<td><input tabindex=8 type="Text" name="BrAddress5" size=21 maxlength=20 value="'. $_POST['BrAddress5'].'"></td></tr>'; + echo '<td><input tabindex=8 type="text" name="BrAddress5" size=21 maxlength=20 value="'. $_POST['BrAddress5'].'"></td></tr>'; echo '<tr><td>'._('Street Address 6').':</td>'; if (!isset($_POST['BrAddress6'])) {$_POST['BrAddress6']='';} - echo '<td><input tabindex=9 type="Text" name="BrAddress6" size=16 maxlength=15 value="'. $_POST['BrAddress6'].'"></td></tr>'; + echo '<td><input tabindex=9 type="text" name="BrAddress6" size=16 maxlength=15 value="'. $_POST['BrAddress6'].'"></td></tr>'; echo '<tr><td>'._('Special Instructions').':</td>'; if (!isset($_POST['specialinstructions'])) {$_POST['specialinstructions']='';} - echo '<td><input tabindex=10 type="Text" name="specialinstructions" size=56 value="'. $_POST['specialinstructions'].'"></td></tr>'; + echo '<td><input tabindex=10 type="text" name="specialinstructions" size=56 value="'. $_POST['specialinstructions'].'"></td></tr>'; echo '<tr><td>'._('Default days to deliver').':</td>'; if (!isset($_POST['EstDeliveryDays'])) {$_POST['EstDeliveryDays']=0;} - echo '<td><input ' .(in_array('EstDeliveryDays',$Errors) ? 'class="inputerror"' : '' ) .' tabindex=11 type="Text" class=number name="EstDeliveryDays" size=4 maxlength=2 value='. $_POST['EstDeliveryDays'].'></td></tr>'; + echo '<td><input ' .(in_array('EstDeliveryDays',$Errors) ? 'class="inputerror"' : '' ) .' tabindex=11 type="text" class=number name="EstDeliveryDays" size=4 maxlength=2 value='. $_POST['EstDeliveryDays'].'></td></tr>'; echo '<tr><td>'._('Forward Date After (day in month)').':</td>'; if (!isset($_POST['FwdDate'])) {$_POST['FwdDate']=0;} - echo '<td><input ' .(in_array('FwdDate',$Errors) ? 'class="inputerror"' : '' ) .' tabindex=12 type="Text" class=number name="FwdDate" size=4 maxlength=2 value='. $_POST['FwdDate'].'></td></tr>'; + echo '<td><input ' .(in_array('FwdDate',$Errors) ? 'class="inputerror"' : '' ) .' tabindex=12 type="text" class=number name="FwdDate" size=4 maxlength=2 value='. $_POST['FwdDate'].'></td></tr>'; echo '<tr><td>'._('Salesperson').':</td>'; echo '<td><select tabindex=13 name="Salesman">'; Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/CustomerInquiry.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -131,7 +131,7 @@ echo '<br /><font color=RED size=4><b>' . _('ACCOUNT ON HOLD') . '</font></b><br />'; } -echo '<table class=selection width=70%> +echo '<table class="selection" width="70%"> <tr> <th width=20%>' . _('Total Balance') . '</th> <th width=20%>' . _('Current') . '</th> @@ -149,11 +149,12 @@ echo '<br /><div class="centre"><form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo _('Show all transactions after') . ': <input tabindex=1 type=text class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" Value="' . $_POST['TransAfterDate'] . '" maxlength =10 size=12>' . '<input tabindex=2 type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '"></div></form><br />'; +echo _('Show all transactions after') . ': <input tabindex=1 type="text" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" Value="' . $_POST['TransAfterDate'] . '" maxlength =10 size=12>' . '<input tabindex=2 type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '"></div> +</form> +<br />'; $DateAfterCriteria = FormatDateForSQL($_POST['TransAfterDate']); - $SQL = "SELECT systypes.typename, debtortrans.id, debtortrans.type, Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/CustomerReceipt.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -700,7 +700,7 @@ /*set up the form whatever */ -echo '<form action="' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . '" method=post name=form1>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . '" method="post" name="form1">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*show the batch header details and the entries in the batch so far */ Modified: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/DailySalesInquiry.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -1,10 +1,7 @@ <?php -/* $Revision: 1.00$ */ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Daily Sales Inquiry'); include('includes/header.inc'); @@ -25,7 +22,7 @@ $_POST['MonthToShow'] = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db); } -$PeriodsResult = DB_query('SELECT periodno, lastdate_in_period FROM periods',$db); +$PeriodsResult = DB_query("SELECT periodno, lastdate_in_period FROM periods",$db); while ($PeriodRow = DB_fetch_array($PeriodsResult)){ if ($_POST['MonthToShow']==$PeriodRow['periodno']) { @@ -38,7 +35,7 @@ echo '</select></td>'; echo '<td>' . _('Salesperson') . ':</td><td><select tabindex=2 name="Salesperson">'; -$SalespeopleResult = DB_query('SELECT salesmancode, salesmanname FROM salesman',$db); +$SalespeopleResult = DB_query("SELECT salesmancode, salesmanname FROM salesman",$db); if (!isset($_POST['Salesperson'])){ $_POST['Salesperson'] = 'All'; echo '<option selected value="All">' . _('All') . '</option>'; Modified: trunk/FTP_RadioBeacon.php =================================================================== --- trunk/FTP_RadioBeacon.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/FTP_RadioBeacon.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -14,30 +14,30 @@ some details of the order for confirming before producing the file for ftp */ $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverto, - salesorders.deliverydate, - sum(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) as ordervalue, - datepackingslipprinted, - printedpackingslip - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorderdetails.completed=0 - AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' - GROUP BY salesorders.orderno, - salesorders.debtorno, - salesorders.branchcode, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverto"; + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverto, + salesorders.deliverydate, + sum(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) as ordervalue, + datepackingslipprinted, + printedpackingslip + FROM salesorders, + salesorderdetails, + debtorsmaster, + custbranch + WHERE salesorders.orderno = salesorderdetails.orderno + AND salesorders.debtorno = debtorsmaster.debtorno + AND debtorsmaster.debtorno = custbranch.debtorno + AND salesorderdetails.completed=0 + AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' + GROUP BY salesorders.orderno, + salesorders.debtorno, + salesorders.branchcode, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverto"; $ErrMsg = _('No orders were returned because'); $SalesOrdersResult = DB_query($SQL,$db,$ErrMsg); @@ -146,33 +146,33 @@ /*Now get the order header info */ $sql = "SELECT salesorders.debtorno, - customerref, - comments, - orddate, - deliverydate, - deliverto, - deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - contactphone, - contactemail, - name, - address1, - address2, - address3, - address4, - address5, - address6, - printedpackingslip, - datepackingslipprinted - FROM salesorders, - debtorsmaster - WHERE salesorders.debtorno=debtorsmaster.debtorno - AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' - AND salesorders.orderno='" . $_GET['OrderNo'] . "'"; + customerref, + comments, + orddate, + deliverydate, + deliverto, + deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + contactphone, + contactemail, + name, + address1, + address2, + address3, + address4, + address5, + address6, + printedpackingslip, + datepackingslipprinted + FROM salesorders, + debtorsmaster + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' + AND salesorders.orderno='" . $_GET['OrderNo'] . "'"; $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('from the database'); Modified: trunk/FreightCosts.php =================================================================== --- trunk/FreightCosts.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/FreightCosts.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -32,13 +32,13 @@ $sql = "SELECT shippername, shipper_id FROM shippers"; $ShipperResults = DB_query($sql,$db); - echo '<table class=selection> + echo '<table class="selection"> <tr> <td>' . _('Select A Freight Company to set up costs for') . '</td> <td><select name="ShipperID">'; while ($myrow = DB_fetch_array($ShipperResults)){ - echo '<option value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; + echo '<option value="' . $myrow['shipper_id'] . '">' . $myrow['shippername'] . '</option>'; } echo '</select></td></tr> <tr> @@ -51,12 +51,12 @@ $LocationResults = DB_query($sql,$db); while ($myrow = DB_fetch_array($LocationResults)){ - echo '<option value=' . $myrow['loccode'] . '>' . $myrow['locationname']; + echo '<option value=' . $myrow['loccode'] . '>' . $myrow['locationname'] . '</option>'; } echo '</select></td></tr> </table> - <br><div class="centre"><input type="submit" value="' . _('Accept') . '" name="Accept"></div> + <br /><div class="centre"><input type="submit" value="' . _('Accept') . '" name="Accept"></div> </form>'; } else { @@ -198,7 +198,7 @@ $result = DB_query($sql,$db); - echo '<br><table class=selection>'; + echo '<br /><table class=selection>'; $TableHeader = '<tr> <th>' . _('Destination') . '</th> <th>' . _('Cubic Rate') . '</th> @@ -307,8 +307,8 @@ $_POST['MinimumChg'] = 0; } - echo '<input type="hidden" name="LocationFrom" value="' . $LocationFrom . '">'; - echo '<input type="hidden" name="ShipperID" value="' . $ShipperID . '">'; + echo '<input type="hidden" name="LocationFrom" value="' . $LocationFrom . '" />'; + echo '<input type="hidden" name="ShipperID" value="' . $ShipperID . '" />'; if (!isset($_POST['Destination'])) {$_POST['Destination']='';} if (!isset($_POST['CubRate'])) {$_POST['CubRate']='';} @@ -316,7 +316,7 @@ if (!isset($_POST['MAXKGs'])) {$_POST['MAXKGs']='';} if (!isset($_POST['MAXCub'])) {$_POST['MAXCub']='';} - echo '<br><table class=selection>'; + echo '<br /><table class=selection>'; echo '<tr><th colspan=2><font size=4 color=blue>' . _('For Deliveries From') . ' ' . $LocationName . ' ' . _('using') . ' ' . $ShipperName . '</font></th></tr>'; echo'<tr><td>' . _('Destination') . ':</td> @@ -334,7 +334,7 @@ echo '<tr><td>' . _('Minimum Charge (0 is N/A)') . ':</a></td> <td><input type="text" name="MinimumChg" class="number" size=6 maxlength=5 value="' . $_POST['MinimumChg'] . '"></td></tr>'; - echo '</table><br>'; + echo '</table><br />'; echo '<div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '"></div>'; Modified: trunk/GLTransInquiry.php =================================================================== --- trunk/GLTransInquiry.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/GLTransInquiry.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -1,16 +1,12 @@ <?php /* $Id$*/ -/* $Revision: 1.16 $ */ -//$PageSecurity = 8; - include ('includes/session.inc'); $title = _('General Ledger Transaction Inquiry'); include('includes/header.inc'); -// Page Border -$menuUrl = '<a href="'. $rootpath . '/index.php?&Application=GL'. SID .'">' . _('General Ledger Menu') . '</a></div>'; +$menuUrl = '<a href="'. $rootpath . '/index.php?&Application=GL">' . _('General Ledger Menu') . '</a></div>'; if ( !isset($_GET['TypeID']) OR !isset($_GET['TransNo']) ) { @@ -52,22 +48,22 @@ </tr>'; $SQL = "SELECT gltrans.type, - gltrans.trandate, - gltrans.periodno, - gltrans.account, - gltrans.narrative, - gltrans.amount, - gltrans.posted, - chartmaster.accountname, - periods.lastdate_in_period - FROM gltrans, - chartmaster, - periods - WHERE gltrans.account = chartmaster.accountcode - AND periods.periodno=gltrans.periodno - AND gltrans.type= '" . $_GET['TypeID'] . "' - AND gltrans.typeno = '" . $_GET['TransNo'] . "' - ORDER BY gltrans.counterindex"; + gltrans.trandate, + gltrans.periodno, + gltrans.account, + gltrans.narrative, + gltrans.amount, + gltrans.posted, + chartmaster.accountname, + periods.lastdate_in_period + FROM gltrans, + chartmaster, + periods + WHERE gltrans.account = chartmaster.accountcode + AND periods.periodno=gltrans.periodno + AND gltrans.type= '" . $_GET['TypeID'] . "' + AND gltrans.typeno = '" . $_GET['TransNo'] . "' + ORDER BY gltrans.counterindex"; $TransResult = DB_query($SQL,$db); $Posted = _('Yes'); @@ -78,17 +74,17 @@ $DetailResult = false; if ( $TransRow['amount'] > 0) { - $DebitAmount = number_format($TransRow['amount'],2); + $DebitAmount = number_format($TransRow['amount'],$_SESSION['CompanyRecord']['decimalplaces']); $DebitTotal += $TransRow['amount']; $CreditAmount = ' '; } else { - $CreditAmount = number_format(-$TransRow['amount'],2); + $CreditAmount = number_format(-$TransRow['amount'],$_SESSION['CompanyRecord']['decimalplaces']); $CreditTotal += $TransRow['amount']; $DebitAmount = ' '; } if ( $TransRow['account'] == $_SESSION['CompanyRecord']['debtorsact'] ) { - $URL = $rootpath . '/CustomerInquiry.php?' . SID . '&CustomerID='; + $URL = $rootpath . '/CustomerInquiry.php?CustomerID='; $date = '&TransAfterDate=' . $TranDate; $DetailSQL = "SELECT debtortrans.debtorno, @@ -103,7 +99,7 @@ AND debtortrans.transno = '" . $_GET['TransNo']. "'"; $DetailResult = DB_query($DetailSQL,$db); } elseif ( $TransRow['account'] == $_SESSION['CompanyRecord']['creditorsact'] ) { - $URL = $rootpath . '/SupplierInquiry.php?' . SID . '&SupplierID='; + $URL = $rootpath . '/SupplierInquiry.php?SupplierID='; $date = '&FromDate=' . $TranDate; $DetailSQL = "SELECT supptrans.supplierno, @@ -118,7 +114,7 @@ AND supptrans.transno = '" . $_GET['TransNo'] . "'"; $DetailResult = DB_query($DetailSQL,$db); } else { - $URL = $rootpath . '/GLAccountInquiry.php?' . SID . '&Account=' . $TransRow['account']; + $URL = $rootpath . '/GLAccountInquiry.php?Account=' . $TransRow['account']; if( strlen($TransRow['narrative'])==0 ) { $TransRow['narrative'] = ' '; @@ -156,10 +152,10 @@ } } else { if ($TransRow['account'] == $_SESSION['CompanyRecord']['debtorsact']) { - $Credit = number_format(-($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],2); + $Credit = number_format(-($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],$_SESSION['CompanyRecord']['decimalplaces']); $Debit = ' '; } else { - $Credit = number_format(($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],2); + $Credit = number_format(($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],$_SESSION['CompanyRecord']['decimalplaces']); $Debit = ' '; } } @@ -187,8 +183,8 @@ echo '<tr bgcolor="#FFFFFF"> <td class=number colspan=3><b>' . _('Total') . '</b></td> - <td class=number>' . number_format(($DebitTotal),2) . '</td> - <td class=number>' . number_format((-$CreditTotal),2) . '</td> + <td class=number>' . number_format(($DebitTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class=number>' . number_format((-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td colspan=2> </td> </tr>'; echo '</table><p>'; @@ -196,7 +192,7 @@ } -echo '</td></tr></table>'; // end Page Border +echo '</td></tr></table>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/GoodsReceived.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -135,8 +135,8 @@ $DisplaySupplierQtyRec = number_format($LnItm->QtyReceived/$LnItm->ConversionFactor,$LnItm->DecimalPlaces); $DisplayQtyOrd = number_format($LnItm->Quantity,$LnItm->DecimalPlaces); $DisplayQtyRec = number_format($LnItm->QtyReceived,$LnItm->DecimalPlaces); - $DisplayLineTotal = number_format($LineTotal,2); - $DisplayPrice = number_format($LnItm->Price,2); + $DisplayLineTotal = number_format($LineTotal,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = number_format($LnItm->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); //Now Display LineItem @@ -178,7 +178,7 @@ }//foreach(LineItem) echo '<script>defaultControl(document.forms[0].RecvQty_'.$LnItm->LineNo.');</script>'; - $DisplayTotal = number_format($_SESSION['PO'.$identifier]->Total,2); + $DisplayTotal = number_format($_SESSION['PO'.$identifier]->Total,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); if ($_SESSION['ShowValueOnGRN']==1) { echo '<tr><td colspan="11" class=number><b>' . _('Total value of goods received'). '</b></td> <td class=number><b>'. $DisplayTotal. '</b></td> @@ -316,8 +316,7 @@ } echo '<div class="centre"><a href="' . $rootpath . '/PO_SelectOSPurchOrder.php">'. _('Select a different purchase order for receiving goods against').'</a></div>'; - echo '<div class="centre"><a href="' . $rootpath . '/GoodsReceived.php?PONumber=' . - $_SESSION['PO'.$identifier]->OrderNumber . '">'. _('Re-read the updated purchase order for receiving goods against'). '</a></div>'; + echo '<div class="centre"><a href="' . $rootpath . '/GoodsReceived.php?PONumber=' . $_SESSION['PO'.$identifier]->OrderNumber . '">'. _('Re-read the updated purchase order for receiving goods against'). '</a></div>'; unset($_SESSION['PO'.$identifier]->LineItems); unset($_SESSION['PO'.$identifier]); unset($_POST['ProcessGoodsReceived']); @@ -514,17 +513,17 @@ AND serialno = '" . $Item->BundleRef . "'"; } else { $SQL = "INSERT INTO stockserialitems (stockid, - loccode, - serialno, - qualitytext, - expirationdate, - quantity) - VALUES ('" . $OrderLine->StockID . "', - '" . $_SESSION['PO'.$identifier]->Location . "', - '" . $Item->BundleRef . "', - '', - '" . FormatDateForSQL($Item->ExpiryDate) . "', - '" . $Item->BundleQty . "')"; + loccode, + serialno, + qualitytext, + expirationdate, + quantity) + VALUES ('" . $OrderLine->StockID . "', + '" . $_SESSION['PO'.$identifier]->Location . "', + '" . $Item->BundleRef . "', + '', + '" . FormatDateForSQL($Item->ExpiryDate) . "', + '" . $Item->BundleQty . "')"; } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be inserted because'); @@ -535,15 +534,15 @@ /** now insert the serial stock movement **/ $SQL = "INSERT INTO stockserialmoves (stockmoveno, - stockid, - serialno, - moveqty) - VALUES ( - '" . $StkMoveNo . "', - '" . $OrderLine->StockID . "', - '" . $Item->BundleRef . "', - '" . $Item->BundleQty . "' - )"; + stockid, + serialno, + moveqty) + VALUES ( + '" . $StkMoveNo . "', + '" . $OrderLine->StockID . "', + '" . $Item->BundleRef . "', + '" . $Item->BundleQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -557,30 +556,31 @@ /*first validate the AssetID and if it doesn't exist treat it like a normal nominal item */ $CheckAssetExistsResult = DB_query("SELECT assetid, - datepurchased, - costact - FROM fixedassets INNER JOIN fixedassetcategories - ON fixedassets.assetcategoryid=fixedassetcategories.categoryid - WHERE assetid='" . $OrderLine->AssetID . "'",$db); + datepurchased, + costact + FROM fixedassets + INNER JOIN fixedassetcategories + ON fixedassets.assetcategoryid=fixedassetcategories.categoryid + WHERE assetid='" . $OrderLine->AssetID . "'",$db); if (DB_num_rows($CheckAssetExistsResult)==1){ //then work with the assetid provided /*Need to add a fixedassettrans for the cost of the asset being received */ $SQL = "INSERT INTO fixedassettrans (assetid, - transtype, - transno, - transdate, - periodno, - inputdate, - fixedassettranstype, - amount) - VALUES ('" . $OrderLine->AssetID . "', - 25, - '" . $GRN . "', - '" . $_POST['DefaultReceivedDate'] . "', - '" . $PeriodNo . "', - '" . Date('Y-m-d') . "', - 'cost', - '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "')"; + transtype, + transno, + transdate, + periodno, + inputdate, + fixedassettranstype, + amount) + VALUES ('" . $OrderLine->AssetID . "', + 25, + '" . $GRN . "', + '" . $_POST['DefaultReceivedDate'] . "', + '" . $PeriodNo . "', + '" . Date('Y-m-d') . "', + 'cost', + '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "')"; $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); @@ -594,12 +594,13 @@ /* it is a new addition as the date is set to 0000-00-00 when the asset record is created * before any cost is added to the asset */ - $SQL = "UPDATE fixedassets SET datepurchased='" . $_POST['DefaultReceivedDate'] . "', - cost = cost + " . ($CurrentStandardCost * $OrderLine->ReceiveQty) . " - WHERE assetid = '" . $OrderLine->AssetID . "'"; + $SQL = "UPDATE fixedassets + SET datepurchased='" . $_POST['DefaultReceivedDate'] . "', + cost = cost + " . ($CurrentStandardCost * $OrderLine->ReceiveQty) . " + WHERE assetid = '" . $OrderLine->AssetID . "'"; } else { $SQL = "UPDATE fixedassets SET cost = cost + " . ($CurrentStandardCost * $OrderLine->ReceiveQty) . " - WHERE assetid = '" . $OrderLine->AssetID . "'"; + WHERE assetid = '" . $OrderLine->AssetID . "'"; } $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE. The fixed asset cost and date purchased was not able to be updated because:'); $DbgMsg = _('The following SQL was used to attempt the update of the cost and the date the asset was purchased'); @@ -614,23 +615,23 @@ /*first the debit using the GLCode in the PO detail record entry*/ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ( - 25, - '" . $GRN . "', - '" . $_POST['DefaultReceivedDate'] . "', - '" . $PeriodNo . "', - '" . $OrderLine->GLCode . "', - 'PO: " . $_SESSION['PO'.$identifier]->OrderNo . " " . $_SESSION['PO'.$identifier]->SupplierID . " - " . $OrderLine->StockID - . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . - number_format($CurrentStandardCost,2) . "', - '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ( + 25, + '" . $GRN . "', + '" . $_POST['DefaultReceivedDate'] . "', + '" . $PeriodNo . "', + '" . $OrderLine->GLCode . "', + 'PO: " . $_SESSION['PO'.$identifier]->OrderNo . " " . $_SESSION['PO'.$identifier]->SupplierID . " - " . $OrderLine->StockID + . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . + number_format($CurrentStandardCost,2) . "', + '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the purchase GLTrans record was used'); @@ -640,22 +641,22 @@ /*now the GRN suspense entry*/ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES (25, - '" . $GRN . "', - '" . $_POST['DefaultReceivedDate'] . "', - '" . $PeriodNo . "', - '" . $_SESSION['CompanyRecord']['grnact'] . "', - '" . _('PO'.$identifier) . ': ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . - $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . - $OrderLine->ReceiveQty . ' @ ' . number_format($UnitCost,2) . "', - '" . -$UnitCost * $OrderLine->ReceiveQty . "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (25, + '" . $GRN . "', + '" . $_POST['DefaultReceivedDate'] . "', + '" . $PeriodNo . "', + '" . $_SESSION['CompanyRecord']['grnact'] . "', + '" . _('PO'.$identifier) . ': ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . + $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . + $OrderLine->ReceiveQty . ' @ ' . number_format($UnitCost,2) . "', + '" . -$UnitCost * $OrderLine->ReceiveQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN suspense side of the GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GRN Suspense GLTrans record was used'); Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/PO_Header.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -146,8 +146,8 @@ $AllowPrint=0; } $SQL = "UPDATE purchorders SET status='" . $_POST['Status']. "', - stat_comment='" . $_SESSION['PO'.$identifier]->StatusComments ."', - allowprint='".$AllowPrint."' + stat_comment='" . $_SESSION['PO'.$identifier]->StatusComments ."', + allowprint='".$AllowPrint."' WHERE purchorders.orderno ='" . $_SESSION['ExistingOrder'] ."'"; $ErrMsg = _('The order status could not be updated because'); @@ -172,8 +172,10 @@ $_SESSION['PO'.$identifier]->GLLink = $_SESSION['CompanyRecord']['gllink_stock']; /* set the SupplierID we got */ $_SESSION['PO'.$identifier]->SupplierID = $_GET['SelectedSupplier']; + $_SESSION['PO'.$identifier]->DeliveryDate = DateAdd(date($_SESSION['DefaultDateFormat']), 'd', $_GET['LeadTime']); $_SESSION['RequireSupplierSelection'] = 0; $_POST['Select'] = $_GET['SelectedSupplier']; + /* * the item (it's item code) that should be purchased @@ -219,8 +221,8 @@ $_SESSION['PO'.$identifier]->AllowPrintPO=1; $sql = "UPDATE purchorders - SET purchorders.allowprint='1' - WHERE purchorders.orderno='" . $_SESSION['PO'.$identifier]->OrderNo ."'"; + SET purchorders.allowprint='1' + WHERE purchorders.orderno='" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('An error occurred updating the purchase order to allow reprints') . '. ' . _('The error says'); $UpdateResult = DB_query($sql,$db,$ErrMsg); @@ -365,6 +367,7 @@ $_POST['SuppDelAdd4']=$_SESSION['PO'.$identifier]->SuppDelAdd4; $_POST['SuppDelAdd5']=$_SESSION['PO'.$identifier]->SuppDelAdd5; $_POST['SuppD... [truncated message content] |
From: <dai...@us...> - 2011-05-23 10:14:15
|
Revision: 4572 http://web-erp.svn.sourceforge.net/web-erp/?rev=4572&view=rev Author: daintree Date: 2011-05-23 10:14:06 +0000 (Mon, 23 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/Areas.php trunk/AuditTrail.php trunk/BankMatching.php trunk/BankReconciliation.php trunk/ContractBOM.php trunk/CreditStatus.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/CustomerReceipt.php trunk/DailySalesInquiry.php trunk/FTP_RadioBeacon.php trunk/FreightCosts.php trunk/GLTransInquiry.php trunk/GoodsReceived.php trunk/PO_Header.php trunk/PO_Items.php trunk/PO_SelectOSPurchOrder.php trunk/PaymentMethods.php trunk/PaymentTerms.php trunk/SelectProduct.php trunk/StockQties_csv.php trunk/SuppInvGRNs.php trunk/SuppTransGLAnalysis.php trunk/SupplierAllocations.php trunk/SupplierInvoice.php trunk/UpgradeDatabase.php trunk/WWW_Access.php trunk/doc/Change.log trunk/includes/DefinePOClass.php trunk/includes/DefineSuppAllocsClass.php trunk/includes/DefineSuppTransClass.php trunk/includes/PO_ReadInOrder.inc trunk/includes/footer.inc trunk/index.php Removed Paths: ------------- trunk/SystemCheck.php Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/Areas.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -1,7 +1,6 @@ <?php -/* $Revision: 1.22 $ */ + /* $Id$*/ -//$PageSecurity = 3; include('includes/session.inc'); @@ -163,7 +162,7 @@ echo '<td>' . $myrow[0] . '</td> <td>' . $myrow[1] . '</td>'; echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '&delete=yes">' . _('Delete') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this sales area?') . '\');">' . _('Delete') . '</a></td>'; echo '<td><a href="SelectCustomer.php'. '?Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; } //END WHILE LIST LOOP Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/AuditTrail.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -30,7 +30,7 @@ echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class=selection>'; +echo '<table class="selection">'; echo '<tr><td>'. _('From Date') . ' ' . $_SESSION['DefaultDateFormat'] .'</td> <td><input tabindex="1" type=text class=date alt="'.$_SESSION['DefaultDateFormat'].'" name="FromDate" size="11" maxlength="10" value=' .$_POST['FromDate'].'></td></tr>'; @@ -40,7 +40,7 @@ // Show user selections echo '<tr><td>'. _('User ID'). '</td> <td><select tabindex="3" name="SelectedUser">'; -echo '<option value="ALL">' . _('ALL') . '</option>'; +echo '<option value="ALL">' . _('All') . '</option>'; while ($users = DB_fetch_row($UserResult)) { if (isset($_POST['SelectedUser']) and $users[0]==$_POST['SelectedUser']) { echo '<option selected value="' . $users[0] . '">' . $users[0] . '</option>'; @@ -53,7 +53,7 @@ // Show table selections echo '<tr><td>'. _('Table '). '</td> <td><select tabindex="4" name="SelectedTable">'; -echo '<option value="ALL">' . _('ALL') . '</option>'; +echo '<option value="ALL">' . _('All') . '</option>'; while ($tables = DB_fetch_row($TableResult)) { if (isset($_POST['SelectedTable']) and $tables[0]==$_POST['SelectedTable']) { echo '<option selected value=' . $tables[0] . '>' . $tables[0] . '</option>'; @@ -176,7 +176,7 @@ for ($i=1; $i<sizeof($_SESSION['SQLString']['fields']); $i++) { if (isset($_SESSION['SQLString']['values'][$i]) and (trim(str_replace("'","",$_SESSION['SQLString']['values'][$i])) != "") & (trim($_SESSION['SQLString']['fields'][$i]) != 'password') & - (trim($_SESSION['SQLString']['fields'][$i]) != "www_users.password")) { + (trim($_SESSION['SQLString']['fields'][$i]) != 'www_users.password')) { echo '<tr bgcolor="' . $RowColour . '">'; echo '<td></td> <td></td> Modified: trunk/BankMatching.php =================================================================== --- trunk/BankMatching.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/BankMatching.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -1,10 +1,8 @@ <?php -/* $Revision: 1.23 $ */ + /* $Id$*/ -//$PageSecurity = 7; - -include("includes/session.inc"); +include('includes/session.inc'); $title = _('Bank Account Matching'); include('includes/header.inc'); @@ -29,9 +27,16 @@ exit; } +if (isset($_GET['Account'])) { + $_POST['BankAccount']=$_GET['Account']; + $_POST['ShowTransactions']=true; + $_POST['Ostg_or_All']='Ostg'; + $_POST['First20_or_All']='All'; +} + if (isset($_POST['Update']) AND $_POST['RowCounter']>1){ for ($Counter=1;$Counter <= $_POST['RowCounter']; $Counter++){ - if (isset($_POST["Clear_" . $Counter]) and $_POST["Clear_" . $Counter]==True){ + if (isset($_POST['Clear_' . $Counter]) AND $_POST['Clear_' . $Counter]==True){ /*Get amount to be cleared */ $sql = "SELECT amount, exrate @@ -79,13 +84,13 @@ echo '<table class=selection><tr>'; echo '<td align=left>' . _('Bank Account') . ':</td><td colspan=3><select tabindex="1" name="BankAccount">'; -$sql = 'SELECT accountcode, bankaccountname FROM bankaccounts'; +$sql = "SELECT accountcode, bankaccountname FROM bankaccounts"; $resultBankActs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultBankActs)){ if (isset($_POST['BankAccount']) and $myrow['accountcode']==$_POST['BankAccount']){ - echo "<option selected Value='" . $myrow['accountcode'] . "'>" . $myrow['bankaccountname']; + echo '<option selected value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . '</option>'; } else { - echo "<option Value='" . $myrow['accountcode'] . "'>" . $myrow['bankaccountname']; + echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['bankaccountname'] . '</option>'; } } @@ -95,12 +100,12 @@ $_POST['BeforeDate'] = Date($_SESSION['DefaultDateFormat']); } if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ - $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date("m")-3,Date("d"),Date("y"))); + $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-3,Date('d'),Date('y'))); } // Change to allow input of FROM DATE and then TO DATE, instead of previous back-to-front method, add datepicker echo '<tr><td>' . _('Show') . ' ' . $TypeName . ' ' . _('from') . ':</td> - <td><input tabindex="3" type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="10" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" Value="' . $_POST['AfterDate'] . '"></td></tr>'; + <td><input tabindex="3" type="text" name="AfterDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="10" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" value="' . $_POST['AfterDate'] . '"></td></tr>'; echo '<td>' . _('to') . ':</td> <td><input tabindex="2" type="text" name="BeforeDate" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" size="12" maxlength="10" onChange="isDate(this, this.value, '."'".$_SESSION['DefaultDateFormat']."'".')" Value="' . $_POST['BeforeDate'] . '"></td>'; @@ -108,29 +113,29 @@ <td><select tabindex="4" name="Ostg_or_All">'; if ($_POST['Ostg_or_All']=='All'){ - echo '<option selected Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option Value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only'); + echo '<option selected value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only') . '</option>'; } else { - echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option selected Value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only'); + echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option selected Value="Ostdg">' . _('Show unmatched') . ' ' . $TypeName . ' ' . _('only') . '</option>'; } echo '</select></td></tr>'; echo '<tr><td colspan=3>' . _('Choose to display only the first 20 matching') . ' ' . $TypeName . ' ' . _('or all') . ' ' . $TypeName . ' ' . _('meeting the criteria') . ':</td><td><select tabindex="5" name="First20_or_All">'; if ($_POST['First20_or_All']=='All'){ - echo '<option selected Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option Value="First20">' . _('Show only the first 20') . ' ' . $TypeName; + echo '<option selected Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option Value="First20">' . _('Show only the first 20') . ' ' . $TypeName . '</option>'; } else { - echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range'); - echo '<option selected Value="First20">' . _('Show only the first 20') . ' ' . $TypeName; + echo '<option Value="All">' . _('Show all') . ' ' . $TypeName . ' ' . _('in the date range') . '</option>'; + echo '<option selected Value="First20">' . _('Show only the first 20') . ' ' . $TypeName . '</option>'; } echo '</select></td></tr>'; echo '</table><br><div class="centre"><input tabindex="6" type=submit name="ShowTransactions" VALUE="' . _('Show selected') . ' ' . $TypeName . '">'; -echo "<p><a href='$rootpath/BankReconciliation.php?" . SID . "'>" . _('Show reconciliation') . '</a></div>'; -echo '<hr>'; +echo '<p><a href="' . $rootpath . '/BankReconciliation.php">' . _('Show reconciliation') . '</a></div>'; +echo '<hr />'; $InputError=0; if (!Is_Date($_POST['BeforeDate'])){ @@ -151,7 +156,7 @@ $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']); $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']); - if ($_POST["Ostg_or_All"]=='All'){ + if ($_POST['Ostg_or_All']=='All'){ if ($Type=='Payments'){ $sql = "SELECT banktransid, ref, @@ -163,7 +168,7 @@ WHERE amount <0 AND transdate >= '". $SQLAfterDate . "' AND transdate <= '" . $SQLBeforeDate . "' - AND bankact='" .$_POST["BankAccount"] . "' + AND bankact='" .$_POST['BankAccount'] . "' ORDER BY transdate"; } else { /* Type must == Receipts */ @@ -192,7 +197,7 @@ WHERE amount <0 AND transdate >= '". $SQLAfterDate . "' AND transdate <= '" . $SQLBeforeDate . "' - AND bankact=" .$_POST["BankAccount"] . " + AND bankact=" .$_POST['BankAccount'] . " AND ABS(amountcleared - (amount / exrate)) > 0.009 ORDER BY transdate"; } else { /* Type must == Receipts */ @@ -206,12 +211,12 @@ WHERE amount >0 AND transdate >= '". $SQLAfterDate . "' AND transdate <= '" . $SQLBeforeDate . "' - AND bankact='" .$_POST["BankAccount"] . "' + AND bankact='" .$_POST['BankAccount'] . "' AND ABS(amountcleared - (amount / exrate)) > 0.009 ORDER BY transdate"; } } - if ($_POST["First20_or_All"]!='All'){ + if ($_POST['First20_or_All']!='All'){ $sql = $sql . " LIMIT 20"; } @@ -219,13 +224,13 @@ $PaymentsResult = DB_query($sql, $db, $ErrMsg); $TableHeader = '<tr><th>'. _('Ref'). '</th> - <th>' . $TypeName . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Amount') . '</th> - <th>' . _('Outstanding') . '</th> - <th colspan=3>' . _('Clear') . ' / ' . _('Unclear') . '</th> - </tr>'; - echo '<table cellpadding=2 class=selection>' . $TableHeader; + <th>' . $TypeName . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Outstanding') . '</th> + <th colspan=3>' . _('Clear') . ' / ' . _('Unclear') . '</th> + </tr>'; + echo '<table cellpadding=2 class="selection">' . $TableHeader; $j = 1; //page length counter @@ -238,24 +243,23 @@ $Outstanding = $myrow['amt']- $myrow['amountcleared']; if (ABS($Outstanding)<0.009){ /*the payment is cleared dont show the check box*/ - printf("<tr bgcolor='#CCCEEE'> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td colspan=2>%s</td> - <td><input type='checkbox' name='Unclear_%s'><input type=hidden name='BankTrans_%s' VALUE=%s></td> - </tr>", - $myrow['ref'], - $myrow['banktranstype'], - $DisplayTranDate, - number_format($myrow['amt'],2), - number_format($Outstanding,2), - _('Unclear'), - $i, - $i, - $myrow['banktransid']); + pprintf('<tr bgcolor="#CCCEEE"> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td colspan=2>%s</td> + <td><input type="checkbox" name="Unclear_%s"><input type="hidden" name="BankTrans_%s" value=%s></td> + </tr>', + $myrow['ref'], + $myrow['banktranstype'], + $DisplayTranDate, + number_format($myrow['amt'],2), + number_format($Outstanding,2), + _('Unclear'), + $i, + $i, + $myrow['banktransid']); } else{ if ($k==1){ @@ -265,15 +269,14 @@ echo '<tr class="OddTableRows">'; $k=1; } - - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td><input type='checkbox' name='Clear_%s'><input type=hidden name='BankTrans_%s' VALUE=%s></td> - <td colspan=2><input type='text' maxlength=15 size=15 class=number name='AmtClear_%s'></td> - </tr>", + <td><input type="checkbox" name="Clear_%s"><input type=hidden name="BankTrans_%s" value=%s></td> + <td colspan=2><input type="text" maxlength=15 size=15 class="number" name="AmtClear_%s"></td> + </tr>', $myrow['ref'], $myrow['banktranstype'], $DisplayTranDate, @@ -296,10 +299,11 @@ } //end of while loop - echo '</table><br><div class="centre"><input type=hidden name="RowCounter" value=' . $i . '><input type=submit name="Update" VALUE="' . _('Update Matching') . '"></div>'; - + echo '</table> + <br /> + <div class="centre"><input type=hidden name="RowCounter" value=' . $i . '> + <input type=submit name="Update" value="' . _('Update Matching') . '"></div>'; } - echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/BankReconciliation.php =================================================================== --- trunk/BankReconciliation.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/BankReconciliation.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -1,29 +1,33 @@ <?php -/* $Revision: 1.15 $ */ /* $Id$*/ -//$PageSecurity = 7; - include ('includes/session.inc'); $title = _('Bank Reconciliation'); include('includes/header.inc'); -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; +if (isset($_GET['Account'])) { + $_POST['BankAccount']=$_GET['Account']; + $_POST['ShowRec']=true; +} + if (isset($_POST['PostExchangeDifference']) and is_numeric($_POST['DoExchangeDifference'])){ - if (!is_numeric($_POST['BankStatmentBalance'])){ + if (!is_numeric($_POST['BankStatementBalance'])){ prnMsg(_('The entry in the bank statement balance is not numeric. The balance on the bank statement should be entered. The exchange difference has not been calculated and no general ledger journal has been created'),'warn'); - echo '<p>' . $_POST['BankStatmentBalance']; + echo '<p>' . $_POST['BankStatementBalance']; } else { /* Now need to get the currency of the account and the current table ex rate */ - $SQL = "SELECT rate, bankaccountname - FROM bankaccounts INNER JOIN currencies - ON bankaccounts.currcode=currencies.currabrev + $SQL = "SELECT rate, + bankaccountname + FROM bankaccounts INNER JOIN currencies + ON bankaccounts.currcode=currencies.currabrev WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; $ErrMsg = _('Could not retrieve the exchange rate for the selected bank account'); @@ -33,7 +37,7 @@ $BankAccountName = $CurrencyRow[1]; $CalculatedBalance = $_POST['DoExchangeDifference']; - $ExchangeDifference = ($CalculatedBalance - $_POST['BankStatmentBalance'])/$ExRate; + $ExchangeDifference = ($CalculatedBalance - $_POST['BankStatementBalance'])/$ExRate; include ('includes/SQL_CommonFunctions.inc'); $ExDiffTransNo = GetNextTransNo(36,$db); @@ -84,20 +88,22 @@ } //end if the bank statement balance was numeric } +echo '<table class="selection">'; +$SQL = "SELECT bankaccountname, accountcode FROM bankaccounts"; -echo '<table>'; - -$SQL = 'SELECT bankaccountname, accountcode FROM bankaccounts'; - $ErrMsg = _('The bank accounts could not be retrieved by the SQL because'); $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); -echo '<tr><td>' . _('Bank Account') . ':</td><td><select tabindex="1" name="BankAccount">'; +echo '<tr><td>' . _('Bank Account') . ':</td> + <td><select tabindex="1" name="BankAccount">'; if (DB_num_rows($AccountsResults)==0){ - echo '</select></td></tr></table><p>' . _('Bank Accounts have not yet been defined') . '. ' . _('You must first') . "<a href='" . $rootpath . "/BankAccounts.php'>" . _('define the bank accounts') . '</a>' . ' ' . _('and general ledger accounts to be affected') . '.'; + echo '</select></td> + </tr> + </table> + <p>' . _('Bank Accounts have not yet been defined') . '. ' . _('You must first') . '<a href="' . $rootpath . '/BankAccounts.php">' . _('define the bank accounts') . '</a>' . ' ' . _('and general ledger accounts to be affected') . '.'; include('includes/footer.inc'); exit; } else { @@ -116,20 +122,24 @@ include ('includes/GLPostings.inc'); -echo '</table><p><div class="centre"><input type=submit tabindex="2" name="ShowRec" value="' . _('Show bank reconciliation statement') . '"></div><br>'; +echo '</table><p><div class="centre"><input type=submit tabindex="2" name="ShowRec" value="' . _('Show bank reconciliation statement') . '"></div><br />'; if (isset($_POST['ShowRec']) OR isset($_POST['DoExchangeDifference'])){ /*Get the balance of the bank account concerned */ - $sql = "SELECT MAX(period) FROM chartdetails WHERE accountcode='" . $_POST['BankAccount']."'"; + $sql = "SELECT MAX(period) + FROM chartdetails + WHERE accountcode='" . $_POST['BankAccount']."'"; $PrdResult = DB_query($sql, $db); $myrow = DB_fetch_row($PrdResult); $LastPeriod = $myrow[0]; $SQL = "SELECT bfwd+actual AS balance - FROM chartdetails WHERE period='" . $LastPeriod . "' AND accountcode='" . $_POST['BankAccount']."'"; + FROM chartdetails + WHERE period='" . $LastPeriod . "' + AND accountcode='" . $_POST['BankAccount']."'"; $ErrMsg = _('The bank account balance could not be returned by the SQL because'); $BalanceResult = DB_query($SQL,$db,$ErrMsg); @@ -141,9 +151,9 @@ $SQL = "SELECT rate, bankaccounts.currcode, bankaccounts.bankaccountname - FROM bankaccounts INNER JOIN currencies - ON bankaccounts.currcode=currencies.currabrev - WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; + FROM bankaccounts INNER JOIN currencies + ON bankaccounts.currcode=currencies.currabrev + WHERE bankaccounts.accountcode = '" . $_POST['BankAccount']."'"; $ErrMsg = _('Could not retrieve the currency and exchange rate for the selected bank account'); $CurrencyResult = DB_query($SQL,$db); $CurrencyRow = DB_fetch_row($CurrencyResult); @@ -151,13 +161,13 @@ $BankCurrCode = $CurrencyRow[1]; $BankAccountName = $CurrencyRow[2]; - echo '<table class=selection> - <tr class=EvenTableRows><td colspan=6><b>' . $BankAccountName . ' ' . _('Balance as at') . ' ' . Date($_SESSION['DefaultDateFormat']); + echo '<table class="selection"> + <tr class="EvenTableRows"><td colspan=6><b>' . $BankAccountName . ' ' . _('Balance as at') . ' ' . Date($_SESSION['DefaultDateFormat']); if ($_SESSION['CompanyRecord']['currencydefault']!=$BankCurrCode){ echo ' (' . $BankCurrCode . ' @ ' . $ExRate .')'; } echo '</b></td> - <td valign=bottom class=number><b>' . number_format($Balance*$ExRate,2) . '</b></td></tr>'; + <td valign=bottom class="number"><b>' . number_format($Balance*$ExRate,2) . '</b></td></tr>'; $SQL = "SELECT amount/exrate AS amt, amountcleared, @@ -181,13 +191,13 @@ echo '<tr><td colspan=6><b>' . _('Add back unpresented cheques') . ':</b></td></tr>'; $TableHeader = '<tr> - <th>' . _('Date') . '</th> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Orig Amount') . '</th> - <th>' . _('Outstanding') . '</th> - </tr>'; + <th>' . _('Date') . '</th> + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Orig Amount') . '</th> + <th>' . _('Outstanding') . '</th> + </tr>'; echo $TableHeader; @@ -307,7 +317,7 @@ if (isset($_POST['DoExchangeDifference'])){ echo '<input type="hidden" name="DoExchangeDifference" value=' . $FXStatementBalance . '>'; echo '<tr><td colspan=6>' . _('Enter the actual bank statement balance') . ' (' . $BankCurrCode . ')</b></td> - <td class=number><input type="text" name="BankStatmentBalance" maxlength=15 size=15 value=' . $_POST['BankStatmentBalance'] . '><td></tr>'; + <td class=number><input type="text" name="BankStatementBalance" maxlength=15 size=15 value=' . $_POST['BankStatementBalance'] . '><td></tr>'; echo '<tr><td colspan=7 align="center"><input type="submit" name="PostExchangeDifference" value="' . _('Calculate and Post Exchange Difference') . '" onclick="return confirm(\'' . _('This will create a general ledger journal to write off the exchange difference in the current balance of the account. It is important that the exchange rate above reflects the current value of the bank account currency') . ' - ' . _('Are You Sure?') . '\');"></td></tr>'; } @@ -323,8 +333,15 @@ echo '</table>'; } -echo '<p><div class="centre"><a tabindex="4" href="' . $rootpath . '/BankMatching.php?' . SID . '&Type=Payments">' . _('Match off cleared payments') . '</a>'; -echo '<br><a tabindex="5" href="' . $rootpath . '/BankMatching.php?' . SID . '&Type=Receipts">' . _('Match off cleared deposits') . '</a></div>'; + +if (isset($_POST['BankAccount'])) { + echo '<p><div class="centre"><a tabindex="4" href="' . $rootpath . '/BankMatching.php?Type=Payments&Account='.$_POST['BankAccount'].'">' . _('Match off cleared payments') . '</a>'; + echo '<br /><a tabindex="5" href="' . $rootpath . '/BankMatching.php?Type=Receipts&Account='.$_POST['BankAccount'].'">' . _('Match off cleared deposits') . '</a></div>'; +} else { + echo '<p><div class="centre"><a tabindex="4" href="' . $rootpath . '/BankMatching.php?Type=Payments">' . _('Match off cleared payments') . '</a>'; + echo '<br /><a tabindex="5" href="' . $rootpath . '/BankMatching.php?Type=Receipts">' . _('Match off cleared deposits') . '</a></div>'; +} + echo '</form>'; include('includes/footer.inc'); ?> Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/ContractBOM.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -290,11 +290,11 @@ $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Search For Stock Items') . '</p>'; - echo '<table class="selection"><tr>'; + echo '<table class="selection"> + <tr></tr> + <tr><td><select name="StockCat">'; - echo ':</tr><tr><td><select name="StockCat">'; - - echo '<option selected="True" value="All">' . _('All').'</option>'; + echo '<option selected="true" value="All">' . _('All').'</option>'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $_POST['StockCat']==$myrow1['categoryid']){ echo '<option selected value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>'; Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/CreditStatus.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -214,14 +214,15 @@ echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '">'; echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '">'; - echo '<table class="selection"><tr><td>'. _('Status Code') .':</td><td>'; - echo $_POST['ReasonCode'] . '</td></tr>'; + echo '<table class="selection"> + <tr><td>'. _('Status Code') .':</td> + <td>' . $_POST['ReasonCode'] . '</td></tr>'; } else { //end of if $SelectedReason only do the else when a new record is being entered if (!isset($_POST['ReasonCode'])) { $_POST['ReasonCode'] = ''; } - echo '<br><table class=selection> + echo '<br /><table class="selection"> <tr> <td>'. _('Status Code') .':</td> <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size=3 maxlength=2></td> Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/CustomerBranches.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -396,8 +396,7 @@ <td>%s</td> <td>%s</td> <td><a href="%s?DebtorNo=%s&SelectedBranch=%s">%s</td> - <td><a href="%s?DebtorNo=%s&SelectedBranch=%s&delete=yes" onclick=\'return confirm("' . - _('Are you sure you wish to delete this branch?') . '");\'>%s</td></tr>', + <td><a href="%s?DebtorNo=%s&SelectedBranch=%s&delete=yes" onclick=\'return confirm("' . _('Are you sure you wish to delete this branch?') . '");\'>%s</td></tr>', $myrow[10], $myrow[2], $myrow[5], @@ -590,42 +589,42 @@ exit; } - echo '<input type=hidden name="DebtorNo" value="'. $DebtorNo . '">'; + echo '<input type=hidden name="DebtorNo" value="'. $DebtorNo . '" />'; echo '<tr><td>'._('Branch Name').':</td>'; if (!isset($_POST['BrName'])) {$_POST['BrName']='';} - echo '<td><input tabindex=2 type="Text" name="BrName" size=41 maxlength=40 value="'. $_POST['BrName'].'"></td></tr>'; + echo '<td><input tabindex=2 type="text" name="BrName" size=41 maxlength=40 value="'. $_POST['BrName'].'"></td></tr>'; echo '<tr><td>'._('Branch Contact').':</td>'; if (!isset($_POST['ContactName'])) {$_POST['ContactName']='';} - echo '<td><input tabindex=3 type="Text" name="ContactName" size=41 maxlength=40 value="'. $_POST['ContactName'].'"></td></tr>'; + echo '<td><input tabindex=3 type="text" name="ContactName" size=41 maxlength=40 value="'. $_POST['ContactName'].'"></td></tr>'; echo '<tr><td>'._('Street Address 1 (Street)').':</td>'; if (!isset($_POST['BrAddress1'])) {$_POST['BrAddress1']='';} - echo '<td><input tabindex=4 type="Text" name="BrAddress1" size=41 maxlength=40 value="'. $_POST['BrAddress1'].'"></td></tr>'; + echo '<td><input tabindex=4 type="text" name="BrAddress1" size=41 maxlength=40 value="'. $_POST['BrAddress1'].'"></td></tr>'; echo '<tr><td>'._('Street Address 2 (Suburb/City)').':</td>'; if (!isset($_POST['BrAddress2'])) {$_POST['BrAddress2']='';} - echo '<td><input tabindex=5 type="Text" name="BrAddress2" size=41 maxlength=40 value="'. $_POST['BrAddress2'].'"></td></tr>'; + echo '<td><input tabindex=5 type="text" name="BrAddress2" size=41 maxlength=40 value="'. $_POST['BrAddress2'].'"></td></tr>'; echo '<tr><td>'._('Street Address 3 (State)').':</td>'; if (!isset($_POST['BrAddress3'])) {$_POST['BrAddress3']='';} - echo '<td><input tabindex=6 type="Text" name="BrAddress3" size=41 maxlength=40 value="'. $_POST['BrAddress3'].'"></td></tr>'; + echo '<td><input tabindex=6 type="text" name="BrAddress3" size=41 maxlength=40 value="'. $_POST['BrAddress3'].'"></td></tr>'; echo '<tr><td>'._('Street Address 4 (Postal Code)').':</td>'; if (!isset($_POST['BrAddress4'])) {$_POST['BrAddress4']='';} - echo '<td><input tabindex=7 type="Text" name="BrAddress4" size=31 maxlength=40 value="'. $_POST['BrAddress4'].'"></td></tr>'; + echo '<td><input tabindex=7 type="text" name="BrAddress4" size=31 maxlength=40 value="'. $_POST['BrAddress4'].'"></td></tr>'; echo '<tr><td>'._('Street Address 5').':</td>'; if (!isset($_POST['BrAddress5'])) {$_POST['BrAddress5']='';} - echo '<td><input tabindex=8 type="Text" name="BrAddress5" size=21 maxlength=20 value="'. $_POST['BrAddress5'].'"></td></tr>'; + echo '<td><input tabindex=8 type="text" name="BrAddress5" size=21 maxlength=20 value="'. $_POST['BrAddress5'].'"></td></tr>'; echo '<tr><td>'._('Street Address 6').':</td>'; if (!isset($_POST['BrAddress6'])) {$_POST['BrAddress6']='';} - echo '<td><input tabindex=9 type="Text" name="BrAddress6" size=16 maxlength=15 value="'. $_POST['BrAddress6'].'"></td></tr>'; + echo '<td><input tabindex=9 type="text" name="BrAddress6" size=16 maxlength=15 value="'. $_POST['BrAddress6'].'"></td></tr>'; echo '<tr><td>'._('Special Instructions').':</td>'; if (!isset($_POST['specialinstructions'])) {$_POST['specialinstructions']='';} - echo '<td><input tabindex=10 type="Text" name="specialinstructions" size=56 value="'. $_POST['specialinstructions'].'"></td></tr>'; + echo '<td><input tabindex=10 type="text" name="specialinstructions" size=56 value="'. $_POST['specialinstructions'].'"></td></tr>'; echo '<tr><td>'._('Default days to deliver').':</td>'; if (!isset($_POST['EstDeliveryDays'])) {$_POST['EstDeliveryDays']=0;} - echo '<td><input ' .(in_array('EstDeliveryDays',$Errors) ? 'class="inputerror"' : '' ) .' tabindex=11 type="Text" class=number name="EstDeliveryDays" size=4 maxlength=2 value='. $_POST['EstDeliveryDays'].'></td></tr>'; + echo '<td><input ' .(in_array('EstDeliveryDays',$Errors) ? 'class="inputerror"' : '' ) .' tabindex=11 type="text" class=number name="EstDeliveryDays" size=4 maxlength=2 value='. $_POST['EstDeliveryDays'].'></td></tr>'; echo '<tr><td>'._('Forward Date After (day in month)').':</td>'; if (!isset($_POST['FwdDate'])) {$_POST['FwdDate']=0;} - echo '<td><input ' .(in_array('FwdDate',$Errors) ? 'class="inputerror"' : '' ) .' tabindex=12 type="Text" class=number name="FwdDate" size=4 maxlength=2 value='. $_POST['FwdDate'].'></td></tr>'; + echo '<td><input ' .(in_array('FwdDate',$Errors) ? 'class="inputerror"' : '' ) .' tabindex=12 type="text" class=number name="FwdDate" size=4 maxlength=2 value='. $_POST['FwdDate'].'></td></tr>'; echo '<tr><td>'._('Salesperson').':</td>'; echo '<td><select tabindex=13 name="Salesman">'; Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/CustomerInquiry.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -131,7 +131,7 @@ echo '<br /><font color=RED size=4><b>' . _('ACCOUNT ON HOLD') . '</font></b><br />'; } -echo '<table class=selection width=70%> +echo '<table class="selection" width="70%"> <tr> <th width=20%>' . _('Total Balance') . '</th> <th width=20%>' . _('Current') . '</th> @@ -149,11 +149,12 @@ echo '<br /><div class="centre"><form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo _('Show all transactions after') . ': <input tabindex=1 type=text class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" Value="' . $_POST['TransAfterDate'] . '" maxlength =10 size=12>' . '<input tabindex=2 type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '"></div></form><br />'; +echo _('Show all transactions after') . ': <input tabindex=1 type="text" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" Value="' . $_POST['TransAfterDate'] . '" maxlength =10 size=12>' . '<input tabindex=2 type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '"></div> +</form> +<br />'; $DateAfterCriteria = FormatDateForSQL($_POST['TransAfterDate']); - $SQL = "SELECT systypes.typename, debtortrans.id, debtortrans.type, Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/CustomerReceipt.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -700,7 +700,7 @@ /*set up the form whatever */ -echo '<form action="' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . '" method=post name=form1>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . '" method="post" name="form1">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*show the batch header details and the entries in the batch so far */ Modified: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/DailySalesInquiry.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -1,10 +1,7 @@ <?php -/* $Revision: 1.00$ */ /* $Id$*/ -//$PageSecurity = 2; - include('includes/session.inc'); $title = _('Daily Sales Inquiry'); include('includes/header.inc'); @@ -25,7 +22,7 @@ $_POST['MonthToShow'] = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db); } -$PeriodsResult = DB_query('SELECT periodno, lastdate_in_period FROM periods',$db); +$PeriodsResult = DB_query("SELECT periodno, lastdate_in_period FROM periods",$db); while ($PeriodRow = DB_fetch_array($PeriodsResult)){ if ($_POST['MonthToShow']==$PeriodRow['periodno']) { @@ -38,7 +35,7 @@ echo '</select></td>'; echo '<td>' . _('Salesperson') . ':</td><td><select tabindex=2 name="Salesperson">'; -$SalespeopleResult = DB_query('SELECT salesmancode, salesmanname FROM salesman',$db); +$SalespeopleResult = DB_query("SELECT salesmancode, salesmanname FROM salesman",$db); if (!isset($_POST['Salesperson'])){ $_POST['Salesperson'] = 'All'; echo '<option selected value="All">' . _('All') . '</option>'; Modified: trunk/FTP_RadioBeacon.php =================================================================== --- trunk/FTP_RadioBeacon.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/FTP_RadioBeacon.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -14,30 +14,30 @@ some details of the order for confirming before producing the file for ftp */ $SQL = "SELECT salesorders.orderno, - debtorsmaster.name, - custbranch.brname, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverto, - salesorders.deliverydate, - sum(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) as ordervalue, - datepackingslipprinted, - printedpackingslip - FROM salesorders, - salesorderdetails, - debtorsmaster, - custbranch - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.debtorno = debtorsmaster.debtorno - AND debtorsmaster.debtorno = custbranch.debtorno - AND salesorderdetails.completed=0 - AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' - GROUP BY salesorders.orderno, - salesorders.debtorno, - salesorders.branchcode, - salesorders.customerref, - salesorders.orddate, - salesorders.deliverto"; + debtorsmaster.name, + custbranch.brname, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverto, + salesorders.deliverydate, + sum(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)) as ordervalue, + datepackingslipprinted, + printedpackingslip + FROM salesorders, + salesorderdetails, + debtorsmaster, + custbranch + WHERE salesorders.orderno = salesorderdetails.orderno + AND salesorders.debtorno = debtorsmaster.debtorno + AND debtorsmaster.debtorno = custbranch.debtorno + AND salesorderdetails.completed=0 + AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' + GROUP BY salesorders.orderno, + salesorders.debtorno, + salesorders.branchcode, + salesorders.customerref, + salesorders.orddate, + salesorders.deliverto"; $ErrMsg = _('No orders were returned because'); $SalesOrdersResult = DB_query($SQL,$db,$ErrMsg); @@ -146,33 +146,33 @@ /*Now get the order header info */ $sql = "SELECT salesorders.debtorno, - customerref, - comments, - orddate, - deliverydate, - deliverto, - deladd1, - deladd2, - deladd3, - deladd4, - deladd5, - deladd6, - contactphone, - contactemail, - name, - address1, - address2, - address3, - address4, - address5, - address6, - printedpackingslip, - datepackingslipprinted - FROM salesorders, - debtorsmaster - WHERE salesorders.debtorno=debtorsmaster.debtorno - AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' - AND salesorders.orderno='" . $_GET['OrderNo'] . "'"; + customerref, + comments, + orddate, + deliverydate, + deliverto, + deladd1, + deladd2, + deladd3, + deladd4, + deladd5, + deladd6, + contactphone, + contactemail, + name, + address1, + address2, + address3, + address4, + address5, + address6, + printedpackingslip, + datepackingslipprinted + FROM salesorders, + debtorsmaster + WHERE salesorders.debtorno=debtorsmaster.debtorno + AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' + AND salesorders.orderno='" . $_GET['OrderNo'] . "'"; $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('from the database'); Modified: trunk/FreightCosts.php =================================================================== --- trunk/FreightCosts.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/FreightCosts.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -32,13 +32,13 @@ $sql = "SELECT shippername, shipper_id FROM shippers"; $ShipperResults = DB_query($sql,$db); - echo '<table class=selection> + echo '<table class="selection"> <tr> <td>' . _('Select A Freight Company to set up costs for') . '</td> <td><select name="ShipperID">'; while ($myrow = DB_fetch_array($ShipperResults)){ - echo '<option value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; + echo '<option value="' . $myrow['shipper_id'] . '">' . $myrow['shippername'] . '</option>'; } echo '</select></td></tr> <tr> @@ -51,12 +51,12 @@ $LocationResults = DB_query($sql,$db); while ($myrow = DB_fetch_array($LocationResults)){ - echo '<option value=' . $myrow['loccode'] . '>' . $myrow['locationname']; + echo '<option value=' . $myrow['loccode'] . '>' . $myrow['locationname'] . '</option>'; } echo '</select></td></tr> </table> - <br><div class="centre"><input type="submit" value="' . _('Accept') . '" name="Accept"></div> + <br /><div class="centre"><input type="submit" value="' . _('Accept') . '" name="Accept"></div> </form>'; } else { @@ -198,7 +198,7 @@ $result = DB_query($sql,$db); - echo '<br><table class=selection>'; + echo '<br /><table class=selection>'; $TableHeader = '<tr> <th>' . _('Destination') . '</th> <th>' . _('Cubic Rate') . '</th> @@ -307,8 +307,8 @@ $_POST['MinimumChg'] = 0; } - echo '<input type="hidden" name="LocationFrom" value="' . $LocationFrom . '">'; - echo '<input type="hidden" name="ShipperID" value="' . $ShipperID . '">'; + echo '<input type="hidden" name="LocationFrom" value="' . $LocationFrom . '" />'; + echo '<input type="hidden" name="ShipperID" value="' . $ShipperID . '" />'; if (!isset($_POST['Destination'])) {$_POST['Destination']='';} if (!isset($_POST['CubRate'])) {$_POST['CubRate']='';} @@ -316,7 +316,7 @@ if (!isset($_POST['MAXKGs'])) {$_POST['MAXKGs']='';} if (!isset($_POST['MAXCub'])) {$_POST['MAXCub']='';} - echo '<br><table class=selection>'; + echo '<br /><table class=selection>'; echo '<tr><th colspan=2><font size=4 color=blue>' . _('For Deliveries From') . ' ' . $LocationName . ' ' . _('using') . ' ' . $ShipperName . '</font></th></tr>'; echo'<tr><td>' . _('Destination') . ':</td> @@ -334,7 +334,7 @@ echo '<tr><td>' . _('Minimum Charge (0 is N/A)') . ':</a></td> <td><input type="text" name="MinimumChg" class="number" size=6 maxlength=5 value="' . $_POST['MinimumChg'] . '"></td></tr>'; - echo '</table><br>'; + echo '</table><br />'; echo '<div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '"></div>'; Modified: trunk/GLTransInquiry.php =================================================================== --- trunk/GLTransInquiry.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/GLTransInquiry.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -1,16 +1,12 @@ <?php /* $Id$*/ -/* $Revision: 1.16 $ */ -//$PageSecurity = 8; - include ('includes/session.inc'); $title = _('General Ledger Transaction Inquiry'); include('includes/header.inc'); -// Page Border -$menuUrl = '<a href="'. $rootpath . '/index.php?&Application=GL'. SID .'">' . _('General Ledger Menu') . '</a></div>'; +$menuUrl = '<a href="'. $rootpath . '/index.php?&Application=GL">' . _('General Ledger Menu') . '</a></div>'; if ( !isset($_GET['TypeID']) OR !isset($_GET['TransNo']) ) { @@ -52,22 +48,22 @@ </tr>'; $SQL = "SELECT gltrans.type, - gltrans.trandate, - gltrans.periodno, - gltrans.account, - gltrans.narrative, - gltrans.amount, - gltrans.posted, - chartmaster.accountname, - periods.lastdate_in_period - FROM gltrans, - chartmaster, - periods - WHERE gltrans.account = chartmaster.accountcode - AND periods.periodno=gltrans.periodno - AND gltrans.type= '" . $_GET['TypeID'] . "' - AND gltrans.typeno = '" . $_GET['TransNo'] . "' - ORDER BY gltrans.counterindex"; + gltrans.trandate, + gltrans.periodno, + gltrans.account, + gltrans.narrative, + gltrans.amount, + gltrans.posted, + chartmaster.accountname, + periods.lastdate_in_period + FROM gltrans, + chartmaster, + periods + WHERE gltrans.account = chartmaster.accountcode + AND periods.periodno=gltrans.periodno + AND gltrans.type= '" . $_GET['TypeID'] . "' + AND gltrans.typeno = '" . $_GET['TransNo'] . "' + ORDER BY gltrans.counterindex"; $TransResult = DB_query($SQL,$db); $Posted = _('Yes'); @@ -78,17 +74,17 @@ $DetailResult = false; if ( $TransRow['amount'] > 0) { - $DebitAmount = number_format($TransRow['amount'],2); + $DebitAmount = number_format($TransRow['amount'],$_SESSION['CompanyRecord']['decimalplaces']); $DebitTotal += $TransRow['amount']; $CreditAmount = ' '; } else { - $CreditAmount = number_format(-$TransRow['amount'],2); + $CreditAmount = number_format(-$TransRow['amount'],$_SESSION['CompanyRecord']['decimalplaces']); $CreditTotal += $TransRow['amount']; $DebitAmount = ' '; } if ( $TransRow['account'] == $_SESSION['CompanyRecord']['debtorsact'] ) { - $URL = $rootpath . '/CustomerInquiry.php?' . SID . '&CustomerID='; + $URL = $rootpath . '/CustomerInquiry.php?CustomerID='; $date = '&TransAfterDate=' . $TranDate; $DetailSQL = "SELECT debtortrans.debtorno, @@ -103,7 +99,7 @@ AND debtortrans.transno = '" . $_GET['TransNo']. "'"; $DetailResult = DB_query($DetailSQL,$db); } elseif ( $TransRow['account'] == $_SESSION['CompanyRecord']['creditorsact'] ) { - $URL = $rootpath . '/SupplierInquiry.php?' . SID . '&SupplierID='; + $URL = $rootpath . '/SupplierInquiry.php?SupplierID='; $date = '&FromDate=' . $TranDate; $DetailSQL = "SELECT supptrans.supplierno, @@ -118,7 +114,7 @@ AND supptrans.transno = '" . $_GET['TransNo'] . "'"; $DetailResult = DB_query($DetailSQL,$db); } else { - $URL = $rootpath . '/GLAccountInquiry.php?' . SID . '&Account=' . $TransRow['account']; + $URL = $rootpath . '/GLAccountInquiry.php?Account=' . $TransRow['account']; if( strlen($TransRow['narrative'])==0 ) { $TransRow['narrative'] = ' '; @@ -156,10 +152,10 @@ } } else { if ($TransRow['account'] == $_SESSION['CompanyRecord']['debtorsact']) { - $Credit = number_format(-($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],2); + $Credit = number_format(-($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],$_SESSION['CompanyRecord']['decimalplaces']); $Debit = ' '; } else { - $Credit = number_format(($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],2); + $Credit = number_format(($DetailRow[1] + $DetailRow[2]) / $DetailRow[3],$_SESSION['CompanyRecord']['decimalplaces']); $Debit = ' '; } } @@ -187,8 +183,8 @@ echo '<tr bgcolor="#FFFFFF"> <td class=number colspan=3><b>' . _('Total') . '</b></td> - <td class=number>' . number_format(($DebitTotal),2) . '</td> - <td class=number>' . number_format((-$CreditTotal),2) . '</td> + <td class=number>' . number_format(($DebitTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + <td class=number>' . number_format((-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td colspan=2> </td> </tr>'; echo '</table><p>'; @@ -196,7 +192,7 @@ } -echo '</td></tr></table>'; // end Page Border +echo '</td></tr></table>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/GoodsReceived.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -135,8 +135,8 @@ $DisplaySupplierQtyRec = number_format($LnItm->QtyReceived/$LnItm->ConversionFactor,$LnItm->DecimalPlaces); $DisplayQtyOrd = number_format($LnItm->Quantity,$LnItm->DecimalPlaces); $DisplayQtyRec = number_format($LnItm->QtyReceived,$LnItm->DecimalPlaces); - $DisplayLineTotal = number_format($LineTotal,2); - $DisplayPrice = number_format($LnItm->Price,2); + $DisplayLineTotal = number_format($LineTotal,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); + $DisplayPrice = number_format($LnItm->Price,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); //Now Display LineItem @@ -178,7 +178,7 @@ }//foreach(LineItem) echo '<script>defaultControl(document.forms[0].RecvQty_'.$LnItm->LineNo.');</script>'; - $DisplayTotal = number_format($_SESSION['PO'.$identifier]->Total,2); + $DisplayTotal = number_format($_SESSION['PO'.$identifier]->Total,$_SESSION['PO'.$identifier]->CurrDecimalPlaces); if ($_SESSION['ShowValueOnGRN']==1) { echo '<tr><td colspan="11" class=number><b>' . _('Total value of goods received'). '</b></td> <td class=number><b>'. $DisplayTotal. '</b></td> @@ -316,8 +316,7 @@ } echo '<div class="centre"><a href="' . $rootpath . '/PO_SelectOSPurchOrder.php">'. _('Select a different purchase order for receiving goods against').'</a></div>'; - echo '<div class="centre"><a href="' . $rootpath . '/GoodsReceived.php?PONumber=' . - $_SESSION['PO'.$identifier]->OrderNumber . '">'. _('Re-read the updated purchase order for receiving goods against'). '</a></div>'; + echo '<div class="centre"><a href="' . $rootpath . '/GoodsReceived.php?PONumber=' . $_SESSION['PO'.$identifier]->OrderNumber . '">'. _('Re-read the updated purchase order for receiving goods against'). '</a></div>'; unset($_SESSION['PO'.$identifier]->LineItems); unset($_SESSION['PO'.$identifier]); unset($_POST['ProcessGoodsReceived']); @@ -514,17 +513,17 @@ AND serialno = '" . $Item->BundleRef . "'"; } else { $SQL = "INSERT INTO stockserialitems (stockid, - loccode, - serialno, - qualitytext, - expirationdate, - quantity) - VALUES ('" . $OrderLine->StockID . "', - '" . $_SESSION['PO'.$identifier]->Location . "', - '" . $Item->BundleRef . "', - '', - '" . FormatDateForSQL($Item->ExpiryDate) . "', - '" . $Item->BundleQty . "')"; + loccode, + serialno, + qualitytext, + expirationdate, + quantity) + VALUES ('" . $OrderLine->StockID . "', + '" . $_SESSION['PO'.$identifier]->Location . "', + '" . $Item->BundleRef . "', + '', + '" . FormatDateForSQL($Item->ExpiryDate) . "', + '" . $Item->BundleQty . "')"; } $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock item record could not be inserted because'); @@ -535,15 +534,15 @@ /** now insert the serial stock movement **/ $SQL = "INSERT INTO stockserialmoves (stockmoveno, - stockid, - serialno, - moveqty) - VALUES ( - '" . $StkMoveNo . "', - '" . $OrderLine->StockID . "', - '" . $Item->BundleRef . "', - '" . $Item->BundleQty . "' - )"; + stockid, + serialno, + moveqty) + VALUES ( + '" . $StkMoveNo . "', + '" . $OrderLine->StockID . "', + '" . $Item->BundleRef . "', + '" . $Item->BundleQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The serial stock movement record could not be inserted because'); $DbgMsg = _('The following SQL to insert the serial stock movement records was used'); $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true); @@ -557,30 +556,31 @@ /*first validate the AssetID and if it doesn't exist treat it like a normal nominal item */ $CheckAssetExistsResult = DB_query("SELECT assetid, - datepurchased, - costact - FROM fixedassets INNER JOIN fixedassetcategories - ON fixedassets.assetcategoryid=fixedassetcategories.categoryid - WHERE assetid='" . $OrderLine->AssetID . "'",$db); + datepurchased, + costact + FROM fixedassets + INNER JOIN fixedassetcategories + ON fixedassets.assetcategoryid=fixedassetcategories.categoryid + WHERE assetid='" . $OrderLine->AssetID . "'",$db); if (DB_num_rows($CheckAssetExistsResult)==1){ //then work with the assetid provided /*Need to add a fixedassettrans for the cost of the asset being received */ $SQL = "INSERT INTO fixedassettrans (assetid, - transtype, - transno, - transdate, - periodno, - inputdate, - fixedassettranstype, - amount) - VALUES ('" . $OrderLine->AssetID . "', - 25, - '" . $GRN . "', - '" . $_POST['DefaultReceivedDate'] . "', - '" . $PeriodNo . "', - '" . Date('Y-m-d') . "', - 'cost', - '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "')"; + transtype, + transno, + transdate, + periodno, + inputdate, + fixedassettranstype, + amount) + VALUES ('" . $OrderLine->AssetID . "', + 25, + '" . $GRN . "', + '" . $_POST['DefaultReceivedDate'] . "', + '" . $PeriodNo . "', + '" . Date('Y-m-d') . "', + 'cost', + '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "')"; $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); @@ -594,12 +594,13 @@ /* it is a new addition as the date is set to 0000-00-00 when the asset record is created * before any cost is added to the asset */ - $SQL = "UPDATE fixedassets SET datepurchased='" . $_POST['DefaultReceivedDate'] . "', - cost = cost + " . ($CurrentStandardCost * $OrderLine->ReceiveQty) . " - WHERE assetid = '" . $OrderLine->AssetID . "'"; + $SQL = "UPDATE fixedassets + SET datepurchased='" . $_POST['DefaultReceivedDate'] . "', + cost = cost + " . ($CurrentStandardCost * $OrderLine->ReceiveQty) . " + WHERE assetid = '" . $OrderLine->AssetID . "'"; } else { $SQL = "UPDATE fixedassets SET cost = cost + " . ($CurrentStandardCost * $OrderLine->ReceiveQty) . " - WHERE assetid = '" . $OrderLine->AssetID . "'"; + WHERE assetid = '" . $OrderLine->AssetID . "'"; } $ErrMsg = _('CRITICAL ERROR! NOTE DOWN THIS ERROR AND SEEK ASSISTANCE. The fixed asset cost and date purchased was not able to be updated because:'); $DbgMsg = _('The following SQL was used to attempt the update of the cost and the date the asset was purchased'); @@ -614,23 +615,23 @@ /*first the debit using the GLCode in the PO detail record entry*/ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ( - 25, - '" . $GRN . "', - '" . $_POST['DefaultReceivedDate'] . "', - '" . $PeriodNo . "', - '" . $OrderLine->GLCode . "', - 'PO: " . $_SESSION['PO'.$identifier]->OrderNo . " " . $_SESSION['PO'.$identifier]->SupplierID . " - " . $OrderLine->StockID - . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . - number_format($CurrentStandardCost,2) . "', - '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ( + 25, + '" . $GRN . "', + '" . $_POST['DefaultReceivedDate'] . "', + '" . $PeriodNo . "', + '" . $OrderLine->GLCode . "', + 'PO: " . $_SESSION['PO'.$identifier]->OrderNo . " " . $_SESSION['PO'.$identifier]->SupplierID . " - " . $OrderLine->StockID + . " - " . $OrderLine->ItemDescription . " x " . $OrderLine->ReceiveQty . " @ " . + number_format($CurrentStandardCost,2) . "', + '" . $CurrentStandardCost * $OrderLine->ReceiveQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the purchase GLTrans record was used'); @@ -640,22 +641,22 @@ /*now the GRN suspense entry*/ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES (25, - '" . $GRN . "', - '" . $_POST['DefaultReceivedDate'] . "', - '" . $PeriodNo . "', - '" . $_SESSION['CompanyRecord']['grnact'] . "', - '" . _('PO'.$identifier) . ': ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . - $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . - $OrderLine->ReceiveQty . ' @ ' . number_format($UnitCost,2) . "', - '" . -$UnitCost * $OrderLine->ReceiveQty . "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES (25, + '" . $GRN . "', + '" . $_POST['DefaultReceivedDate'] . "', + '" . $PeriodNo . "', + '" . $_SESSION['CompanyRecord']['grnact'] . "', + '" . _('PO'.$identifier) . ': ' . $_SESSION['PO'.$identifier]->OrderNo . ' ' . $_SESSION['PO'.$identifier]->SupplierID . ' - ' . + $OrderLine->StockID . ' - ' . $OrderLine->ItemDescription . ' x ' . + $OrderLine->ReceiveQty . ' @ ' . number_format($UnitCost,2) . "', + '" . -$UnitCost * $OrderLine->ReceiveQty . "' + )"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The GRN suspense side of the GL posting could not be inserted because'); $DbgMsg = _('The following SQL to insert the GRN Suspense GLTrans record was used'); Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-05-16 10:46:50 UTC (rev 4571) +++ trunk/PO_Header.php 2011-05-23 10:14:06 UTC (rev 4572) @@ -146,8 +146,8 @@ $AllowPrint=0; } $SQL = "UPDATE purchorders SET status='" . $_POST['Status']. "', - stat_comment='" . $_SESSION['PO'.$identifier]->StatusComments ."', - allowprint='".$AllowPrint."' + stat_comment='" . $_SESSION['PO'.$identifier]->StatusComments ."', + allowprint='".$AllowPrint."' WHERE purchorders.orderno ='" . $_SESSION['ExistingOrder'] ."'"; $ErrMsg = _('The order status could not be updated because'); @@ -172,8 +172,10 @@ $_SESSION['PO'.$identifier]->GLLink = $_SESSION['CompanyRecord']['gllink_stock']; /* set the SupplierID we got */ $_SESSION['PO'.$identifier]->SupplierID = $_GET['SelectedSupplier']; + $_SESSION['PO'.$identifier]->DeliveryDate = DateAdd(date($_SESSION['DefaultDateFormat']), 'd', $_GET['LeadTime']); $_SESSION['RequireSupplierSelection'] = 0; $_POST['Select'] = $_GET['SelectedSupplier']; + /* * the item (it's item code) that should be purchased @@ -219,8 +221,8 @@ $_SESSION['PO'.$identifier]->AllowPrintPO=1; $sql = "UPDATE purchorders - SET purchorders.allowprint='1' - WHERE purchorders.orderno='" . $_SESSION['PO'.$identifier]->OrderNo ."'"; + SET purchorders.allowprint='1' + WHERE purchorders.orderno='" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('An error occurred updating the purchase order to allow reprints') . '. ' . _('The error says'); $UpdateResult = DB_query($sql,$db,$ErrMsg); @@ -365,6 +367,7 @@ $_POST['SuppDelAdd4']=$_SESSION['PO'.$identifier]->SuppDelAdd4; $_POST['SuppDelAdd5']=$_SESSION['PO'.$identifier]->SuppDelAdd5; $_POST['SuppD... [truncated message content] |
From: <dai...@us...> - 2011-05-16 10:46:57
|
Revision: 4571 http://web-erp.svn.sourceforge.net/web-erp/?rev=4571&view=rev Author: daintree Date: 2011-05-16 10:46:50 +0000 (Mon, 16 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/PO_Header.php trunk/SelectOrderItems.php trunk/doc/Change.log Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-05-16 07:41:47 UTC (rev 4570) +++ trunk/PO_Header.php 2011-05-16 10:46:50 UTC (rev 4571) @@ -84,7 +84,7 @@ if ($_POST['Status'] == 'Authorised') { if ($AuthorityLevel > $OrderTotal) { - $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']) . ' - ' . _('Authorised by') . $UserChangedStatus . $_POST['StatusComments'] . '<br />' . html_entity_decode($_POST['StatusCommentsComplete']); + $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']) . ' - ' . _('Authorised by') . $UserChangedStatus . $_POST['StatusComments'] . '<br />' . html_entity_decode($_POST['StatusCommentsComplete'],ENT_QUOTES,'UTF-8'); $_SESSION['PO'.$identifier]->AllowPrintPO=1; } else { $OKToUpdateStatus=0; @@ -109,7 +109,7 @@ } if ($OKToUpdateStatus==1){ // none of the order has been received if ($AuthorityLevel>$OrderTotal) { - $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . $_POST['Status'] . ' ' . _('by') . $UserChangedStatus . $_POST['StatusComments'].'<br />' . $_POST['StatusCommentsComplete']; + $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . $_POST['Status'] . ' ' . _('by') . $UserChangedStatus . $_POST['StatusComments'].'<br />' . html_entity_decode($_POST['StatusCommentsComplete'], ENT_QUOTES,'UTF-8'); } else { $OKToUpdateStatus=0; prnMsg( _('You do not have permission to reject this purchase order').'.<br />'. _('This order is for').' '. @@ -129,7 +129,7 @@ if (($AuthorityLevel>$OrderTotal OR $_SESSION['UserID']==$_SESSION['PO'.$identifier]->Initiator ) AND $OKToUpdateStatus==1) { - $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . _('Order set to pending status by') . $UserChangedStatus . $_POST['StatusComments']. '<br />' .$_POST['StatusCommentsComplete']; + $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . _('Order set to pending status by') . $UserChangedStatus . $_POST['StatusComments']. '<br />' .html_entity_decode($_POST['StatusCommentsComplete'],ENT_QUOTES,'UTF-8'); } elseif ($AuthorityLevel<$OrderTotal AND $_SESSION['UserID']!=$_SESSION['PO'.$identifier]->Initiator) { $OKToUpdateStatus=0; @@ -281,7 +281,7 @@ if ($_SESSION['PO'.$identifier]->Any_Already_Received()==0){ $_SESSION['RequireSupplierSelection']=1; $_SESSION['PO'.$identifier]->Status = 'Pending'; - $_SESSION['PO'.$identifier]->StatusComments==date($_SESSION['DefaultDateFormat']).' - ' . _('Supplier changed by') . ' <a href="mailto:'. $_SESSION['UserEmail'] .'">'.$_SESSION['UserID']. '</a> - '.$_POST['StatusComments'].'<br />'.$_POST['StatusCommentsComplete']; + $_SESSION['PO'.$identifier]->StatusComments==date($_SESSION['DefaultDateFormat']).' - ' . _('Supplier changed by') . ' <a href="mailto:'. $_SESSION['UserEmail'] .'">'.$_SESSION['UserID']. '</a> - '.$_POST['StatusComments'].'<br />'.html_entity_decode($_POST['StatusCommentsComplete'], ENT_QUOTES,'UTF-8'); } else { echo '<br /><br />'; prnMsg(_('Cannot modify the supplier of the order once some of the order has been received'),'warn'); @@ -583,7 +583,6 @@ if ($_SESSION['ExistingOrder']) { echo _(' Modify Purchase Order Number') . ' ' . $_SESSION['PO'.$identifier]->OrderNo; - echo '</p>'; } if (isset($Purch_Item)) { @@ -689,7 +688,7 @@ </tr> <tr><td style="width:50%">'; //sub table starts - echo '<table class=selection width=100%>'; + echo '<table class="selection" width="100%">'; echo '<tr><td>' . _('PO Date') . ':</td><td>'; if ($_SESSION['ExistingOrder']!=0){ echo ConvertSQLDate($_SESSION['PO'.$identifier]->Orig_OrderDate); @@ -757,8 +756,9 @@ } echo '</table>'; - - echo '<td style="width:50%" valign=top><table class=selection width=100%>'; + //Set up the next column with a sub-table in it too + echo '<td style="width:50%" valign=top> + <table class="selection" width="100%">'; if($_SESSION['ExistingOrder'] != 0 AND $_SESSION['PO'.$identifier]->Status == 'Printed'){ @@ -769,7 +769,8 @@ echo '<input type="hidden" name="Status" value="NewOrder">'; echo '<tr><td>' . _('New Purchase Order') . '</td></tr>'; } else { - echo '<tr><td>' . _('Status') . ' : </td><td><select name="Status" onChange="ReloadForm(form1.UpdateStatus)">'; + echo '<tr><td>' . _('Status') . ' : </td> + <td><select name="Status" onChange="ReloadForm(form1.UpdateStatus)">'; switch ($_SESSION['PO'.$identifier]->Status) { case 'Pending': @@ -807,8 +808,8 @@ echo '<tr><td>' . _('Status Comment') . ':</td> <td><input type=text name="StatusComments" size=50></td></tr> <tr><td colspan=2><b>' . $_SESSION['PO'.$identifier]->StatusComments .'</b></td></tr>'; - //need to use single quotes as double quotes inside the string of StatusComments - echo '<input type="hidden" name="StatusCommentsComplete" value="' . $_SESSION['PO'.$identifier]->StatusComments .'">'; + + echo '<input type="hidden" name="StatusCommentsComplete" value="' . htmlentities($_SESSION['PO'.$identifier]->StatusComments, ENT_QUOTES,'UTF-8') .'" />'; echo '<tr><td><input type="submit" name="UpdateStatus" value="' . _('Status Update') .'"></td>'; } //end its not a new order Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-05-16 07:41:47 UTC (rev 4570) +++ trunk/SelectOrderItems.php 2011-05-16 10:46:50 UTC (rev 4571) @@ -1652,10 +1652,9 @@ // Find the quantity on outstanding sales orders $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem - FROM salesorderdetails, - salesorders - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.fromstkloc='" . $_SESSION['Items'.$identifier]->Location . "' + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + WHERE salesorders.fromstkloc='" . $_SESSION['Items'.$identifier]->Location . "' AND salesorderdetails.completed=0 AND salesorders.quotation=0 AND salesorderdetails.stkcode='" . $myrow['stockid'] . "'"; @@ -1672,7 +1671,8 @@ // Find the quantity on purchase orders $sql = "SELECT SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo - FROM purchorderdetails INNER JOIN purchorders + FROM purchorderdetails INNER JOIN purchorders + ON purchorderdetails.orderno=purchorders.orderno WHERE purchorderdetails.completed=0 AND purchorders.status<>'Cancelled' AND purchorders.status<>'Rejected' Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-05-16 07:41:47 UTC (rev 4570) +++ trunk/doc/Change.log 2011-05-16 10:46:50 UTC (rev 4571) @@ -1,6 +1,7 @@ webERP Change Log -15/5/11 Added upgrade from 4.03.7 to UpgradeDatabase.php +16/5/11 Bug in quantity on purchase order in SelectOrderItems.php added correct join syntax +16/5/11 Added upgrade from 4.03.7 to UpgradeDatabase.php 15/5/11 Z_ChangeStockCode.php modified to test if MRP tables exist before doing the updates - turned off error trapping on these queries as the error trapping is done in the script 15/5/11 Tim: FixedAssetCategories prior to deletion of a category check for existing assets in the category failed due to typo in SQL - fixed 14/5/11 Tim: StockTransfer now checks for negative stock before allowing transfer - launchpad changes to 4691 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-16 10:46:56
|
Revision: 4571 http://web-erp.svn.sourceforge.net/web-erp/?rev=4571&view=rev Author: daintree Date: 2011-05-16 10:46:50 +0000 (Mon, 16 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/PO_Header.php trunk/SelectOrderItems.php trunk/doc/Change.log Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-05-16 07:41:47 UTC (rev 4570) +++ trunk/PO_Header.php 2011-05-16 10:46:50 UTC (rev 4571) @@ -84,7 +84,7 @@ if ($_POST['Status'] == 'Authorised') { if ($AuthorityLevel > $OrderTotal) { - $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']) . ' - ' . _('Authorised by') . $UserChangedStatus . $_POST['StatusComments'] . '<br />' . html_entity_decode($_POST['StatusCommentsComplete']); + $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']) . ' - ' . _('Authorised by') . $UserChangedStatus . $_POST['StatusComments'] . '<br />' . html_entity_decode($_POST['StatusCommentsComplete'],ENT_QUOTES,'UTF-8'); $_SESSION['PO'.$identifier]->AllowPrintPO=1; } else { $OKToUpdateStatus=0; @@ -109,7 +109,7 @@ } if ($OKToUpdateStatus==1){ // none of the order has been received if ($AuthorityLevel>$OrderTotal) { - $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . $_POST['Status'] . ' ' . _('by') . $UserChangedStatus . $_POST['StatusComments'].'<br />' . $_POST['StatusCommentsComplete']; + $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . $_POST['Status'] . ' ' . _('by') . $UserChangedStatus . $_POST['StatusComments'].'<br />' . html_entity_decode($_POST['StatusCommentsComplete'], ENT_QUOTES,'UTF-8'); } else { $OKToUpdateStatus=0; prnMsg( _('You do not have permission to reject this purchase order').'.<br />'. _('This order is for').' '. @@ -129,7 +129,7 @@ if (($AuthorityLevel>$OrderTotal OR $_SESSION['UserID']==$_SESSION['PO'.$identifier]->Initiator ) AND $OKToUpdateStatus==1) { - $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . _('Order set to pending status by') . $UserChangedStatus . $_POST['StatusComments']. '<br />' .$_POST['StatusCommentsComplete']; + $_SESSION['PO'.$identifier]->StatusComments = date($_SESSION['DefaultDateFormat']).' - ' . _('Order set to pending status by') . $UserChangedStatus . $_POST['StatusComments']. '<br />' .html_entity_decode($_POST['StatusCommentsComplete'],ENT_QUOTES,'UTF-8'); } elseif ($AuthorityLevel<$OrderTotal AND $_SESSION['UserID']!=$_SESSION['PO'.$identifier]->Initiator) { $OKToUpdateStatus=0; @@ -281,7 +281,7 @@ if ($_SESSION['PO'.$identifier]->Any_Already_Received()==0){ $_SESSION['RequireSupplierSelection']=1; $_SESSION['PO'.$identifier]->Status = 'Pending'; - $_SESSION['PO'.$identifier]->StatusComments==date($_SESSION['DefaultDateFormat']).' - ' . _('Supplier changed by') . ' <a href="mailto:'. $_SESSION['UserEmail'] .'">'.$_SESSION['UserID']. '</a> - '.$_POST['StatusComments'].'<br />'.$_POST['StatusCommentsComplete']; + $_SESSION['PO'.$identifier]->StatusComments==date($_SESSION['DefaultDateFormat']).' - ' . _('Supplier changed by') . ' <a href="mailto:'. $_SESSION['UserEmail'] .'">'.$_SESSION['UserID']. '</a> - '.$_POST['StatusComments'].'<br />'.html_entity_decode($_POST['StatusCommentsComplete'], ENT_QUOTES,'UTF-8'); } else { echo '<br /><br />'; prnMsg(_('Cannot modify the supplier of the order once some of the order has been received'),'warn'); @@ -583,7 +583,6 @@ if ($_SESSION['ExistingOrder']) { echo _(' Modify Purchase Order Number') . ' ' . $_SESSION['PO'.$identifier]->OrderNo; - echo '</p>'; } if (isset($Purch_Item)) { @@ -689,7 +688,7 @@ </tr> <tr><td style="width:50%">'; //sub table starts - echo '<table class=selection width=100%>'; + echo '<table class="selection" width="100%">'; echo '<tr><td>' . _('PO Date') . ':</td><td>'; if ($_SESSION['ExistingOrder']!=0){ echo ConvertSQLDate($_SESSION['PO'.$identifier]->Orig_OrderDate); @@ -757,8 +756,9 @@ } echo '</table>'; - - echo '<td style="width:50%" valign=top><table class=selection width=100%>'; + //Set up the next column with a sub-table in it too + echo '<td style="width:50%" valign=top> + <table class="selection" width="100%">'; if($_SESSION['ExistingOrder'] != 0 AND $_SESSION['PO'.$identifier]->Status == 'Printed'){ @@ -769,7 +769,8 @@ echo '<input type="hidden" name="Status" value="NewOrder">'; echo '<tr><td>' . _('New Purchase Order') . '</td></tr>'; } else { - echo '<tr><td>' . _('Status') . ' : </td><td><select name="Status" onChange="ReloadForm(form1.UpdateStatus)">'; + echo '<tr><td>' . _('Status') . ' : </td> + <td><select name="Status" onChange="ReloadForm(form1.UpdateStatus)">'; switch ($_SESSION['PO'.$identifier]->Status) { case 'Pending': @@ -807,8 +808,8 @@ echo '<tr><td>' . _('Status Comment') . ':</td> <td><input type=text name="StatusComments" size=50></td></tr> <tr><td colspan=2><b>' . $_SESSION['PO'.$identifier]->StatusComments .'</b></td></tr>'; - //need to use single quotes as double quotes inside the string of StatusComments - echo '<input type="hidden" name="StatusCommentsComplete" value="' . $_SESSION['PO'.$identifier]->StatusComments .'">'; + + echo '<input type="hidden" name="StatusCommentsComplete" value="' . htmlentities($_SESSION['PO'.$identifier]->StatusComments, ENT_QUOTES,'UTF-8') .'" />'; echo '<tr><td><input type="submit" name="UpdateStatus" value="' . _('Status Update') .'"></td>'; } //end its not a new order Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2011-05-16 07:41:47 UTC (rev 4570) +++ trunk/SelectOrderItems.php 2011-05-16 10:46:50 UTC (rev 4571) @@ -1652,10 +1652,9 @@ // Find the quantity on outstanding sales orders $sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem - FROM salesorderdetails, - salesorders - WHERE salesorders.orderno = salesorderdetails.orderno - AND salesorders.fromstkloc='" . $_SESSION['Items'.$identifier]->Location . "' + FROM salesorderdetails INNER JOIN salesorders + ON salesorders.orderno = salesorderdetails.orderno + WHERE salesorders.fromstkloc='" . $_SESSION['Items'.$identifier]->Location . "' AND salesorderdetails.completed=0 AND salesorders.quotation=0 AND salesorderdetails.stkcode='" . $myrow['stockid'] . "'"; @@ -1672,7 +1671,8 @@ // Find the quantity on purchase orders $sql = "SELECT SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qoo - FROM purchorderdetails INNER JOIN purchorders + FROM purchorderdetails INNER JOIN purchorders + ON purchorderdetails.orderno=purchorders.orderno WHERE purchorderdetails.completed=0 AND purchorders.status<>'Cancelled' AND purchorders.status<>'Rejected' Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-05-16 07:41:47 UTC (rev 4570) +++ trunk/doc/Change.log 2011-05-16 10:46:50 UTC (rev 4571) @@ -1,6 +1,7 @@ webERP Change Log -15/5/11 Added upgrade from 4.03.7 to UpgradeDatabase.php +16/5/11 Bug in quantity on purchase order in SelectOrderItems.php added correct join syntax +16/5/11 Added upgrade from 4.03.7 to UpgradeDatabase.php 15/5/11 Z_ChangeStockCode.php modified to test if MRP tables exist before doing the updates - turned off error trapping on these queries as the error trapping is done in the script 15/5/11 Tim: FixedAssetCategories prior to deletion of a category check for existing assets in the category failed due to typo in SQL - fixed 14/5/11 Tim: StockTransfer now checks for negative stock before allowing transfer - launchpad changes to 4691 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-16 07:41:56
|
Revision: 4570 http://web-erp.svn.sourceforge.net/web-erp/?rev=4570&view=rev Author: daintree Date: 2011-05-16 07:41:47 +0000 (Mon, 16 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/Suppliers.php trunk/UpgradeDatabase.php trunk/Z_ChangeStockCode.php trunk/doc/Change.log Modified: trunk/Suppliers.php =================================================================== --- trunk/Suppliers.php 2011-05-15 07:53:42 UTC (rev 4569) +++ trunk/Suppliers.php 2011-05-16 07:41:47 UTC (rev 4570) @@ -936,7 +936,7 @@ DB_data_seek($result, 0); - $sql = 'SELECT taxgroupid, taxgroupdescription FROM taxgroups'; + $sql = "SELECT taxgroupid, taxgroupdescription FROM taxgroups"; $result = DB_query($sql, $db); while ($myrow = DB_fetch_array($result)) { Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-05-15 07:53:42 UTC (rev 4569) +++ trunk/UpgradeDatabase.php 2011-05-16 07:41:47 UTC (rev 4570) @@ -107,6 +107,7 @@ case '4.03': case '4.03.2': case '4.03.5': + case '4.03.7': $SQLScripts[] = './sql/mysql/upgrade3.11.1-4.00.sql'; case '4.03.8': $SQLScripts[] = './sql/mysql/upgrade4.03-4.04.sql'; Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2011-05-15 07:53:42 UTC (rev 4569) +++ trunk/Z_ChangeStockCode.php 2011-05-16 07:41:47 UTC (rev 4570) @@ -1,4 +1,5 @@ <?php + /* $Id$*/ /*Script to Delete all sales transactions*/ @@ -124,7 +125,7 @@ //check if MRP tables exist before assuming - $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",$db); + $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",$db,'','',false,false); if ($DB_error_no==0) { echo '<br />' . _('Changing MRP planned orders information'); $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; @@ -133,7 +134,7 @@ echo ' ... ' . _('completed'); } - $result = DB_query("SELECT * FROM mrprequirements" , $db); + $result = DB_query("SELECT * FROM mrprequirements" , $db,'','',false,false); if (DB_error_no($db)==0){ echo '<br />' . _('Changing MRP requirements information'); $sql = "UPDATE mrprequirements SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; @@ -141,7 +142,7 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); } - $result = DB_query("SELECT * FROM mrpsupplies" , $db); + $result = DB_query("SELECT * FROM mrpsupplies" , $db,'','',false,false); if (DB_error_no($db)==0){ echo '<br />' . _('Changing MRP supplies information'); $sql = "UPDATE mrpsupplies SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-05-15 07:53:42 UTC (rev 4569) +++ trunk/doc/Change.log 2011-05-16 07:41:47 UTC (rev 4570) @@ -1,6 +1,7 @@ webERP Change Log -15/5/11 Z_ChangeStockCode.php modified to test if MRP tables exist before doing the updates +15/5/11 Added upgrade from 4.03.7 to UpgradeDatabase.php +15/5/11 Z_ChangeStockCode.php modified to test if MRP tables exist before doing the updates - turned off error trapping on these queries as the error trapping is done in the script 15/5/11 Tim: FixedAssetCategories prior to deletion of a category check for existing assets in the category failed due to typo in SQL - fixed 14/5/11 Tim: StockTransfer now checks for negative stock before allowing transfer - launchpad changes to 4691 14/5/11 CustomerInquiry.php now shows the currency decimal places This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-16 07:41:53
|
Revision: 4570 http://web-erp.svn.sourceforge.net/web-erp/?rev=4570&view=rev Author: daintree Date: 2011-05-16 07:41:47 +0000 (Mon, 16 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/Suppliers.php trunk/UpgradeDatabase.php trunk/Z_ChangeStockCode.php trunk/doc/Change.log Modified: trunk/Suppliers.php =================================================================== --- trunk/Suppliers.php 2011-05-15 07:53:42 UTC (rev 4569) +++ trunk/Suppliers.php 2011-05-16 07:41:47 UTC (rev 4570) @@ -936,7 +936,7 @@ DB_data_seek($result, 0); - $sql = 'SELECT taxgroupid, taxgroupdescription FROM taxgroups'; + $sql = "SELECT taxgroupid, taxgroupdescription FROM taxgroups"; $result = DB_query($sql, $db); while ($myrow = DB_fetch_array($result)) { Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-05-15 07:53:42 UTC (rev 4569) +++ trunk/UpgradeDatabase.php 2011-05-16 07:41:47 UTC (rev 4570) @@ -107,6 +107,7 @@ case '4.03': case '4.03.2': case '4.03.5': + case '4.03.7': $SQLScripts[] = './sql/mysql/upgrade3.11.1-4.00.sql'; case '4.03.8': $SQLScripts[] = './sql/mysql/upgrade4.03-4.04.sql'; Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2011-05-15 07:53:42 UTC (rev 4569) +++ trunk/Z_ChangeStockCode.php 2011-05-16 07:41:47 UTC (rev 4570) @@ -1,4 +1,5 @@ <?php + /* $Id$*/ /*Script to Delete all sales transactions*/ @@ -124,7 +125,7 @@ //check if MRP tables exist before assuming - $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",$db); + $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",$db,'','',false,false); if ($DB_error_no==0) { echo '<br />' . _('Changing MRP planned orders information'); $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; @@ -133,7 +134,7 @@ echo ' ... ' . _('completed'); } - $result = DB_query("SELECT * FROM mrprequirements" , $db); + $result = DB_query("SELECT * FROM mrprequirements" , $db,'','',false,false); if (DB_error_no($db)==0){ echo '<br />' . _('Changing MRP requirements information'); $sql = "UPDATE mrprequirements SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; @@ -141,7 +142,7 @@ $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); } - $result = DB_query("SELECT * FROM mrpsupplies" , $db); + $result = DB_query("SELECT * FROM mrpsupplies" , $db,'','',false,false); if (DB_error_no($db)==0){ echo '<br />' . _('Changing MRP supplies information'); $sql = "UPDATE mrpsupplies SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-05-15 07:53:42 UTC (rev 4569) +++ trunk/doc/Change.log 2011-05-16 07:41:47 UTC (rev 4570) @@ -1,6 +1,7 @@ webERP Change Log -15/5/11 Z_ChangeStockCode.php modified to test if MRP tables exist before doing the updates +15/5/11 Added upgrade from 4.03.7 to UpgradeDatabase.php +15/5/11 Z_ChangeStockCode.php modified to test if MRP tables exist before doing the updates - turned off error trapping on these queries as the error trapping is done in the script 15/5/11 Tim: FixedAssetCategories prior to deletion of a category check for existing assets in the category failed due to typo in SQL - fixed 14/5/11 Tim: StockTransfer now checks for negative stock before allowing transfer - launchpad changes to 4691 14/5/11 CustomerInquiry.php now shows the currency decimal places This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-15 07:53:49
|
Revision: 4569 http://web-erp.svn.sourceforge.net/web-erp/?rev=4569&view=rev Author: daintree Date: 2011-05-15 07:53:42 +0000 (Sun, 15 May 2011) Log Message: ----------- Change Stock Code fix Modified Paths: -------------- trunk/MRP.php trunk/Z_ChangeStockCode.php trunk/build/make_release.sh trunk/doc/Change.log Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/MRP.php 2011-05-15 07:53:42 UTC (rev 4569) @@ -314,16 +314,16 @@ prnMsg(_('Loading requirements based on reorder level'),'info'); flush(); - $result = DB_query('ALTER TABLE mrprequirements ADD INDEX part(part)',$db); + $result = DB_query("ALTER TABLE mrprequirements ADD INDEX part(part)",$db); // In the following section, create mrpsupplies from open purchase orders, // open work orders, and current quantity onhand from locstock prnMsg(_('Creating supplies table'),'info'); flush(); - $result = DB_query('DROP TABLE IF EXISTS mrpsupplies',$db); + $result = DB_query("DROP TABLE IF EXISTS mrpsupplies",$db); // updateflag is set to 1 in UpdateSupplies if change date when matching requirements to // supplies. Actually only change update flag in the array created from mrpsupplies - $sql = 'CREATE TABLE mrpsupplies ( id int(11) NOT NULL auto_increment, + $sql = "CREATE TABLE mrpsupplies ( id int(11) NOT NULL auto_increment, part char(20), duedate date, supplyquantity double, @@ -331,7 +331,7 @@ orderno int(11), mrpdate date, updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8'; + PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrpsupplies failed because')); prnMsg(_('Loading supplies from purchase orders'),'info'); @@ -424,7 +424,7 @@ WHERE workorders.closed=0"; $result = DB_query($sql,$db); - $sql = 'ALTER TABLE mrpsupplies ADD INDEX part(part)'; + $sql = "ALTER TABLE mrpsupplies ADD INDEX part(part)"; $result = DB_query($sql,$db); // Create mrpplannedorders table to create a record for any unmet requirments @@ -432,8 +432,8 @@ // open work orders, and current quantity onhand from locstock prnMsg(_('Creating planned orders table'),'info'); flush(); - $result = DB_query('DROP TABLE IF EXISTS mrpplannedorders',$db); - $sql = 'CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, + $result = DB_query("DROP TABLE IF EXISTS mrpplannedorders",$db); + $sql = "CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, part char(20), duedate date, supplyquantity double, @@ -441,11 +441,11 @@ orderno int(11), mrpdate date, updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8'; + PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrpplannedorders failed because')); // Find the highest and lowest level number - $sql = 'SELECT MAX(level),MIN(level) from levels'; + $sql = "SELECT MAX(level),MIN(level) from levels"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -471,16 +471,16 @@ echo '</br>' . _('End time') . ': ' . date('h:i:s') . '</br>'; // Create mrpparameters table - $sql = 'DROP TABLE IF EXISTS mrpparameters'; + $sql = "DROP TABLE IF EXISTS mrpparameters"; $result = DB_query($sql,$db); - $sql = 'CREATE TABLE mrpparameters ( + $sql = "CREATE TABLE mrpparameters ( runtime datetime, location varchar(50), pansizeflag varchar(5), shrinkageflag varchar(5), eoqflag varchar(5), usemrpdemands varchar(5), - leeway smallint) DEFAULT CHARSET=utf8'; + leeway smallint) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db); // Create entry for location field from $_POST['location'], which is an array // since multiple locations can be selected @@ -515,7 +515,7 @@ _('Inventory') . '" alt="" />' . ' ' . $title . '</p>'; // Display parameters from last run - $sql = 'SELECT * FROM mrpparameters'; + $sql = "SELECT * FROM mrpparameters"; $result = DB_query($sql,$db,'','',false,false); if (DB_error_no($db)==0){ @@ -551,7 +551,7 @@ echo '<td>' . _('Use Shrinkage') . ':  </td><td>' . $useshrinkage . '</td></tr>'; echo '</table></td>'; } - echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . "'>"; + echo '<p><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; // Generate selections for Location @@ -560,9 +560,9 @@ <td>' . _('Location') . '</td> <td><select name="location[]" multiple> <option value="All" selected>' . _('All') . '</option>'; - $sql = 'SELECT loccode, + $sql = "SELECT loccode, locationname - FROM locations'; + FROM locations"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { echo '<option value="'; Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/Z_ChangeStockCode.php 2011-05-15 07:53:42 UTC (rev 4569) @@ -1,53 +1,72 @@ <?php /* $Id$*/ + /*Script to Delete all sales transactions*/ -//$PageSecurity=15; include ('includes/session.inc'); $title = _('UTILITY PAGE Change A Stock Code'); include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); if (isset($_POST['ProcessStockChange'])){ - + + $InputError =0; + $_POST['NewStockID'] = strtoupper($_POST['NewStockID']); /*First check the stock code exists */ $result=DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'",$db); if (DB_num_rows($result)==0){ prnMsg(_('The stock code') . ': ' . $_POST['OldStockID'] . ' ' . _('does not currently exist as a stock code in the system'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } if (ContainsIllegalCharacters($_POST['NewStockID'])){ prnMsg(_('The new stock code to change the old code to contains illegal characters - no changes will be made'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } if ($_POST['NewStockID']==''){ prnMsg(_('The new stock code to change the old code to must be entered as well'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } /*Now check that the new code doesn't already exist */ $result=DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_POST['NewStockID'] . "'",$db); if (DB_num_rows($result)!=0){ - echo '<br><br>'; + echo '<br /><br />'; prnMsg(_('The replacement stock code') . ': ' . $_POST['NewStockID'] . ' ' . _('already exists as a stock code in the system') . ' - ' . _('a unique stock code must be entered for the new code'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } - - $result = DB_Txn_Begin($db); - - echo '<br>' . _('Adding the new stock master record'); - $sql = "INSERT INTO stockmaster (stockid, + if ($InputError ==0){ // no input errors + $result = DB_Txn_Begin($db); + + echo '<br />' . _('Adding the new stock master record'); + $sql = "INSERT INTO stockmaster (stockid, + categoryid, + description, + longdescription, + units, + mbflag, + lastcurcostdate, + actualcost, + lastcost, + materialcost, + labourcost, + overheadcost, + lowestlevel, + discontinued, + controlled, + eoq, + volume, + kgs, + barcode, + discountcategory, + taxcatid) + SELECT '" . $_POST['NewStockID'] . "', categoryid, description, longdescription, @@ -67,256 +86,238 @@ kgs, barcode, discountcategory, - taxcatid) - SELECT '" . $_POST['NewStockID'] . "', - categoryid, - description, - longdescription, - units, - mbflag, - lastcurcostdate, - actualcost, - lastcost, - materialcost, - labourcost, - overheadcost, - lowestlevel, - discontinued, - controlled, - eoq, - volume, - kgs, - barcode, - discountcategory, - taxcatid - FROM stockmaster - WHERE stockid='" . $_POST['OldStockID'] . "'"; - - $DbgMsg = _('The SQL statement that failed was'); - $ErrMsg =_('The SQL to insert the new stock master record failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing stock location records'); - $sql = "UPDATE locstock SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock location records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing stock movement records'); - $sql = "UPDATE stockmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock movement transaction records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing location transfer information'); - - $sql = "UPDATE loctransfers SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the loctransfers records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing MRP demands information'); - - $sql = "UPDATE mrpdemands SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpdemands records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql="select count(table_name) from information_schema.tables where table_schema='".$_SESSION['DatabaseName']."' and table_name='mrpplannedorders'"; - $result = DB_query($sql,$db); - $row=DB_fetch_row($result); - if ($row[0]>0) { - echo '<BR>' . _('Changing MRP planned orders information'); - - $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpplannedorders records failed'); + taxcatid + FROM stockmaster + WHERE stockid='" . $_POST['OldStockID'] . "'"; + + $DbgMsg = _('The SQL statement that failed was'); + $ErrMsg =_('The SQL to insert the new stock master record failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - } - - echo '<BR>' . _('Changing MRP requirements information'); - - $sql = "UPDATE mrprequirements SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrprequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing MRP supplies information'); - - $sql = "UPDATE mrpsupplies SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpsupplies records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - - echo '<br>' . _('Changing sales analysis records'); - $sql = "UPDATE salesanalysis SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update Sales Analysis records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing order delivery differences records'); - $sql = "UPDATE orderdeliverydifferenceslog SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update order delivery differences records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing pricing records'); - $sql = "UPDATE prices SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the pricing records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing sales orders detail records'); - $sql = "UPDATE salesorderdetails SET stkcode='" . $_POST['NewStockID'] . "' WHERE stkcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the sales order header records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing purchase order details records'); - $sql = "UPDATE purchorderdetails SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the purchase order detail records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing purchasing data records'); - $sql = "UPDATE purchdata SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the purchasing data records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock code in shipment charges records'); - $sql = "UPDATE shipmentcharges SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update Shipment Charges records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock check freeze file records'); - $sql = "UPDATE stockcheckfreeze SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock check freeze records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock counts table records'); - $sql = "UPDATE stockcounts SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock counts records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the GRNs table records'); - $sql = "UPDATE grns SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update GRN records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the contract BOM table records'); - $sql = "UPDATE contractbom SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to contract BOM records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the BOM table records') . ' - ' . _('components'); - $sql = "UPDATE bom SET component='" . $_POST['NewStockID'] . "' WHERE component='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the BOM records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the BOM table records') . ' - ' . _('parents'); - $sql = "UPDATE bom SET parent='" . $_POST['NewStockID'] . "' WHERE parent='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the BOM parent records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing any image files'); - if (file_exists($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg')) { - if (rename($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg', - $_SESSION['part_pics_dir'] . '/' .$_POST['NewStockID'].'.jpg')) { - echo ' ... ' . _('completed'); - } else { - echo ' ... ' . _('failed'); - } - } else { + + echo '<br />' . _('Changing stock location records'); + $sql = "UPDATE locstock SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock location records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - } - - echo '<br>' . _('Changing the item properties table records') . ' - ' . _('parents'); - $sql = "UPDATE stockitemproperties SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the item properties records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = 'SET FOREIGN_KEY_CHECKS=0'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - - echo '<BR>' . _('Changing work order requirements information'); - - $sql = "UPDATE worequirements SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockid worequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = "UPDATE worequirements SET parentstockid='" . $_POST['NewStockID'] . "' WHERE parentstockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the parent stockid worequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing work order information'); - - $sql = "UPDATE woitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the woitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing any serialised item information'); - - - $sql = "UPDATE stockserialitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockserialitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - $sql = "UPDATE stockserialmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockserialitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = 'SET FOREIGN_KEY_CHECKS=1'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - - $result = DB_Txn_Commit($db); - - echo '<br>' . _('Deleting the old stock master record'); - $sql = "DELETE FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to delete the old stock master record failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<p>' . _('Stock Code') . ': ' . $_POST['OldStockID'] . ' ' . _('was successfully changed to') . ' : ' . $_POST['NewStockID']; - + + echo '<br />' . _('Changing stock movement records'); + $sql = "UPDATE stockmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock movement transaction records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing location transfer information'); + + $sql = "UPDATE loctransfers SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the loctransfers records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + + echo '<br />' . _('Changing MRP demands information'); + $sql = "UPDATE mrpdemands SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpdemands records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + //check if MRP tables exist before assuming + + $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",$db); + if ($DB_error_no==0) { + echo '<br />' . _('Changing MRP planned orders information'); + $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpplannedorders records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + + $result = DB_query("SELECT * FROM mrprequirements" , $db); + if (DB_error_no($db)==0){ + echo '<br />' . _('Changing MRP requirements information'); + $sql = "UPDATE mrprequirements SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrprequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + $result = DB_query("SELECT * FROM mrpsupplies" , $db); + if (DB_error_no($db)==0){ + echo '<br />' . _('Changing MRP supplies information'); + $sql = "UPDATE mrpsupplies SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpsupplies records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + + echo '<br />' . _('Changing sales analysis records'); + $sql = "UPDATE salesanalysis SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update Sales Analysis records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing order delivery differences records'); + $sql = "UPDATE orderdeliverydifferenceslog SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update order delivery differences records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing pricing records'); + $sql = "UPDATE prices SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the pricing records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing sales orders detail records'); + $sql = "UPDATE salesorderdetails SET stkcode='" . $_POST['NewStockID'] . "' WHERE stkcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the sales order header records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing purchase order details records'); + $sql = "UPDATE purchorderdetails SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the purchase order detail records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing purchasing data records'); + $sql = "UPDATE purchdata SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the purchasing data records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock code in shipment charges records'); + $sql = "UPDATE shipmentcharges SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update Shipment Charges records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock check freeze file records'); + $sql = "UPDATE stockcheckfreeze SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock check freeze records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock counts table records'); + $sql = "UPDATE stockcounts SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock counts records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the GRNs table records'); + $sql = "UPDATE grns SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update GRN records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the contract BOM table records'); + $sql = "UPDATE contractbom SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to contract BOM records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the BOM table records') . ' - ' . _('components'); + $sql = "UPDATE bom SET component='" . $_POST['NewStockID'] . "' WHERE component='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the BOM records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the BOM table records') . ' - ' . _('parents'); + $sql = "UPDATE bom SET parent='" . $_POST['NewStockID'] . "' WHERE parent='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the BOM parent records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing any image files'); + if (file_exists($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg')) { + if (rename($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg', + $_SESSION['part_pics_dir'] . '/' .$_POST['NewStockID'].'.jpg')) { + echo ' ... ' . _('completed'); + } else { + echo ' ... ' . _('failed'); + } + } else { + echo ' ... ' . _('completed'); + } + + echo '<br />' . _('Changing the item properties table records') . ' - ' . _('parents'); + $sql = "UPDATE stockitemproperties SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the item properties records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = 'SET FOREIGN_KEY_CHECKS=0'; + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + + echo '<br />' . _('Changing work order requirements information'); + + $sql = "UPDATE worequirements SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockid worequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = "UPDATE worequirements SET parentstockid='" . $_POST['NewStockID'] . "' WHERE parentstockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the parent stockid worequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing work order information'); + + $sql = "UPDATE woitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the woitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing any serialised item information'); + + + $sql = "UPDATE stockserialitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockserialitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + $sql = "UPDATE stockserialmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockserialitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = 'SET FOREIGN_KEY_CHECKS=1'; + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + + $result = DB_Txn_Commit($db); + + echo '<br />' . _('Deleting the old stock master record'); + $sql = "DELETE FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to delete the old stock master record failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<p>' . _('Stock Code') . ': ' . $_POST['OldStockID'] . ' ' . _('was successfully changed to') . ' : ' . $_POST['NewStockID']; + } //only do the stuff above if $InputError==0 + } -echo "<form action='" . $_SERVER['PHP_SELF'] . "?=" . $SID . "' method=post>"; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p><table> - <tr><td>' . _('Existing Inventory Code') . ":</td> - <td><input type=Text name='OldStockID' size=20 maxlength=20></td></tr>"; + <tr><td>' . _('Existing Inventory Code') . ':</td> + <td><input type=Text name="OldStockID" size=20 maxlength=20></td></tr>'; -echo '<tr><td>' . _('New Inventory Code') . ":</td><td><input type=Text name='NewStockID' size=20 maxlength=20></td></tr>"; +echo '<tr><td>' . _('New Inventory Code') . ':</td> + <td><input type="text" name="NewStockID" size=20 maxlength=20></td></tr>'; echo '</table>'; -echo "<div class=centre><input type=submit name='ProcessStockChange' VALUE='" . _('Process') . "'></div>"; +echo '<div class="centre"><input type="submit" name="ProcessStockChange" value="' . _('Process') . '"></div>'; echo '</form>'; Modified: trunk/build/make_release.sh =================================================================== --- trunk/build/make_release.sh 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/build/make_release.sh 2011-05-15 07:53:42 UTC (rev 4569) @@ -69,7 +69,7 @@ echo "SET FOREIGN_KEY_CHECKS = 0;" > $BASE_DIR/sql/mysql/weberp-new.sql -mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --create-options --skip-set-charset --no-data weberpdemo >> $BASE_DIR/sql/mysql/weberp-new.sql +mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --create-options --skip-set-charset --ignore-table=weberpdemo.mrpsupplies --ignore-table=weberpdemo.mrpplanedorders --ignore-table=weberpdemo.mrpparameters --ignore-table=weberpdemo.levels --ignore-table=weberpdemo.mrprequirements --ignore-table=weberpdemo.audittrail --no-data weberpdemo >> $BASE_DIR/sql/mysql/weberp-new.sql mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --no-create-info weberpdemo \ accountgroups \ @@ -101,10 +101,10 @@ accountsection \ > $BASE_DIR/sql/mysql/weberp-base.sql -mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --no-create-info weberpdemo > $BASE_DIR/sql/mysql/weberp-demo_data.sql +mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --ignore-table=weberpdemo.mrpsupplies --ignore-table=weberpdemo.mrpplanedorders --ignore-table=weberpdemo.mrpparameters --ignore-table=weberpdemo.levels --ignore-table=weberpdemo.mrprequirements --no-create-info weberpdemo > $BASE_DIR/sql/mysql/weberp-demo_data.sql rm $BASE_DIR/sql/mysql/weberp-demo.sql -echo "CREATE DATABASE weberpdemo;" > $BASE_DIR/sql/mysql/weberp-demo.sql +echo "CREATE DATABASE IF NOT EXISTS weberpdemo;" > $BASE_DIR/sql/mysql/weberp-demo.sql echo "USE weberpdemo;" >> $BASE_DIR/sql/mysql/weberp-demo.sql cat $BASE_DIR/sql/mysql/weberp-new.sql >> $BASE_DIR/sql/mysql/weberp-demo.sql Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/doc/Change.log 2011-05-15 07:53:42 UTC (rev 4569) @@ -1,6 +1,6 @@ webERP Change Log - +15/5/11 Z_ChangeStockCode.php modified to test if MRP tables exist before doing the updates 15/5/11 Tim: FixedAssetCategories prior to deletion of a category check for existing assets in the category failed due to typo in SQL - fixed 14/5/11 Tim: StockTransfer now checks for negative stock before allowing transfer - launchpad changes to 4691 14/5/11 CustomerInquiry.php now shows the currency decimal places This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-15 07:53:49
|
Revision: 4569 http://web-erp.svn.sourceforge.net/web-erp/?rev=4569&view=rev Author: daintree Date: 2011-05-15 07:53:42 +0000 (Sun, 15 May 2011) Log Message: ----------- Change Stock Code fix Modified Paths: -------------- trunk/MRP.php trunk/Z_ChangeStockCode.php trunk/build/make_release.sh trunk/doc/Change.log Modified: trunk/MRP.php =================================================================== --- trunk/MRP.php 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/MRP.php 2011-05-15 07:53:42 UTC (rev 4569) @@ -314,16 +314,16 @@ prnMsg(_('Loading requirements based on reorder level'),'info'); flush(); - $result = DB_query('ALTER TABLE mrprequirements ADD INDEX part(part)',$db); + $result = DB_query("ALTER TABLE mrprequirements ADD INDEX part(part)",$db); // In the following section, create mrpsupplies from open purchase orders, // open work orders, and current quantity onhand from locstock prnMsg(_('Creating supplies table'),'info'); flush(); - $result = DB_query('DROP TABLE IF EXISTS mrpsupplies',$db); + $result = DB_query("DROP TABLE IF EXISTS mrpsupplies",$db); // updateflag is set to 1 in UpdateSupplies if change date when matching requirements to // supplies. Actually only change update flag in the array created from mrpsupplies - $sql = 'CREATE TABLE mrpsupplies ( id int(11) NOT NULL auto_increment, + $sql = "CREATE TABLE mrpsupplies ( id int(11) NOT NULL auto_increment, part char(20), duedate date, supplyquantity double, @@ -331,7 +331,7 @@ orderno int(11), mrpdate date, updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8'; + PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrpsupplies failed because')); prnMsg(_('Loading supplies from purchase orders'),'info'); @@ -424,7 +424,7 @@ WHERE workorders.closed=0"; $result = DB_query($sql,$db); - $sql = 'ALTER TABLE mrpsupplies ADD INDEX part(part)'; + $sql = "ALTER TABLE mrpsupplies ADD INDEX part(part)"; $result = DB_query($sql,$db); // Create mrpplannedorders table to create a record for any unmet requirments @@ -432,8 +432,8 @@ // open work orders, and current quantity onhand from locstock prnMsg(_('Creating planned orders table'),'info'); flush(); - $result = DB_query('DROP TABLE IF EXISTS mrpplannedorders',$db); - $sql = 'CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, + $result = DB_query("DROP TABLE IF EXISTS mrpplannedorders",$db); + $sql = "CREATE TABLE mrpplannedorders (id int(11) NOT NULL auto_increment, part char(20), duedate date, supplyquantity double, @@ -441,11 +441,11 @@ orderno int(11), mrpdate date, updateflag smallint(6), - PRIMARY KEY (id)) DEFAULT CHARSET=utf8'; + PRIMARY KEY (id)) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db,_('Create of mrpplannedorders failed because')); // Find the highest and lowest level number - $sql = 'SELECT MAX(level),MIN(level) from levels'; + $sql = "SELECT MAX(level),MIN(level) from levels"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -471,16 +471,16 @@ echo '</br>' . _('End time') . ': ' . date('h:i:s') . '</br>'; // Create mrpparameters table - $sql = 'DROP TABLE IF EXISTS mrpparameters'; + $sql = "DROP TABLE IF EXISTS mrpparameters"; $result = DB_query($sql,$db); - $sql = 'CREATE TABLE mrpparameters ( + $sql = "CREATE TABLE mrpparameters ( runtime datetime, location varchar(50), pansizeflag varchar(5), shrinkageflag varchar(5), eoqflag varchar(5), usemrpdemands varchar(5), - leeway smallint) DEFAULT CHARSET=utf8'; + leeway smallint) DEFAULT CHARSET=utf8"; $result = DB_query($sql,$db); // Create entry for location field from $_POST['location'], which is an array // since multiple locations can be selected @@ -515,7 +515,7 @@ _('Inventory') . '" alt="" />' . ' ' . $title . '</p>'; // Display parameters from last run - $sql = 'SELECT * FROM mrpparameters'; + $sql = "SELECT * FROM mrpparameters"; $result = DB_query($sql,$db,'','',false,false); if (DB_error_no($db)==0){ @@ -551,7 +551,7 @@ echo '<td>' . _('Use Shrinkage') . ':  </td><td>' . $useshrinkage . '</td></tr>'; echo '</table></td>'; } - echo "<p><form method='post' action='" . $_SERVER['PHP_SELF'] . "'>"; + echo '<p><form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; // Generate selections for Location @@ -560,9 +560,9 @@ <td>' . _('Location') . '</td> <td><select name="location[]" multiple> <option value="All" selected>' . _('All') . '</option>'; - $sql = 'SELECT loccode, + $sql = "SELECT loccode, locationname - FROM locations'; + FROM locations"; $result = DB_query($sql,$db); while ($myrow = DB_fetch_array($result)) { echo '<option value="'; Modified: trunk/Z_ChangeStockCode.php =================================================================== --- trunk/Z_ChangeStockCode.php 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/Z_ChangeStockCode.php 2011-05-15 07:53:42 UTC (rev 4569) @@ -1,53 +1,72 @@ <?php /* $Id$*/ + /*Script to Delete all sales transactions*/ -//$PageSecurity=15; include ('includes/session.inc'); $title = _('UTILITY PAGE Change A Stock Code'); include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); if (isset($_POST['ProcessStockChange'])){ - + + $InputError =0; + $_POST['NewStockID'] = strtoupper($_POST['NewStockID']); /*First check the stock code exists */ $result=DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'",$db); if (DB_num_rows($result)==0){ prnMsg(_('The stock code') . ': ' . $_POST['OldStockID'] . ' ' . _('does not currently exist as a stock code in the system'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } if (ContainsIllegalCharacters($_POST['NewStockID'])){ prnMsg(_('The new stock code to change the old code to contains illegal characters - no changes will be made'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } if ($_POST['NewStockID']==''){ prnMsg(_('The new stock code to change the old code to must be entered as well'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } /*Now check that the new code doesn't already exist */ $result=DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $_POST['NewStockID'] . "'",$db); if (DB_num_rows($result)!=0){ - echo '<br><br>'; + echo '<br /><br />'; prnMsg(_('The replacement stock code') . ': ' . $_POST['NewStockID'] . ' ' . _('already exists as a stock code in the system') . ' - ' . _('a unique stock code must be entered for the new code'),'error'); - include('includes/footer.inc'); - exit; + $InputError =1; } - - $result = DB_Txn_Begin($db); - - echo '<br>' . _('Adding the new stock master record'); - $sql = "INSERT INTO stockmaster (stockid, + if ($InputError ==0){ // no input errors + $result = DB_Txn_Begin($db); + + echo '<br />' . _('Adding the new stock master record'); + $sql = "INSERT INTO stockmaster (stockid, + categoryid, + description, + longdescription, + units, + mbflag, + lastcurcostdate, + actualcost, + lastcost, + materialcost, + labourcost, + overheadcost, + lowestlevel, + discontinued, + controlled, + eoq, + volume, + kgs, + barcode, + discountcategory, + taxcatid) + SELECT '" . $_POST['NewStockID'] . "', categoryid, description, longdescription, @@ -67,256 +86,238 @@ kgs, barcode, discountcategory, - taxcatid) - SELECT '" . $_POST['NewStockID'] . "', - categoryid, - description, - longdescription, - units, - mbflag, - lastcurcostdate, - actualcost, - lastcost, - materialcost, - labourcost, - overheadcost, - lowestlevel, - discontinued, - controlled, - eoq, - volume, - kgs, - barcode, - discountcategory, - taxcatid - FROM stockmaster - WHERE stockid='" . $_POST['OldStockID'] . "'"; - - $DbgMsg = _('The SQL statement that failed was'); - $ErrMsg =_('The SQL to insert the new stock master record failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing stock location records'); - $sql = "UPDATE locstock SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock location records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing stock movement records'); - $sql = "UPDATE stockmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock movement transaction records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing location transfer information'); - - $sql = "UPDATE loctransfers SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the loctransfers records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing MRP demands information'); - - $sql = "UPDATE mrpdemands SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpdemands records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql="select count(table_name) from information_schema.tables where table_schema='".$_SESSION['DatabaseName']."' and table_name='mrpplannedorders'"; - $result = DB_query($sql,$db); - $row=DB_fetch_row($result); - if ($row[0]>0) { - echo '<BR>' . _('Changing MRP planned orders information'); - - $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpplannedorders records failed'); + taxcatid + FROM stockmaster + WHERE stockid='" . $_POST['OldStockID'] . "'"; + + $DbgMsg = _('The SQL statement that failed was'); + $ErrMsg =_('The SQL to insert the new stock master record failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - } - - echo '<BR>' . _('Changing MRP requirements information'); - - $sql = "UPDATE mrprequirements SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrprequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing MRP supplies information'); - - $sql = "UPDATE mrpsupplies SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the mrpsupplies records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - - echo '<br>' . _('Changing sales analysis records'); - $sql = "UPDATE salesanalysis SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update Sales Analysis records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing order delivery differences records'); - $sql = "UPDATE orderdeliverydifferenceslog SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update order delivery differences records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing pricing records'); - $sql = "UPDATE prices SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the pricing records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing sales orders detail records'); - $sql = "UPDATE salesorderdetails SET stkcode='" . $_POST['NewStockID'] . "' WHERE stkcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the sales order header records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing purchase order details records'); - $sql = "UPDATE purchorderdetails SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the purchase order detail records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing purchasing data records'); - $sql = "UPDATE purchdata SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the purchasing data records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock code in shipment charges records'); - $sql = "UPDATE shipmentcharges SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update Shipment Charges records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock check freeze file records'); - $sql = "UPDATE stockcheckfreeze SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock check freeze records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing the stock counts table records'); - $sql = "UPDATE stockcounts SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update stock counts records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the GRNs table records'); - $sql = "UPDATE grns SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update GRN records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the contract BOM table records'); - $sql = "UPDATE contractbom SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to contract BOM records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the BOM table records') . ' - ' . _('components'); - $sql = "UPDATE bom SET component='" . $_POST['NewStockID'] . "' WHERE component='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the BOM records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing the BOM table records') . ' - ' . _('parents'); - $sql = "UPDATE bom SET parent='" . $_POST['NewStockID'] . "' WHERE parent='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the BOM parent records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<br>' . _('Changing any image files'); - if (file_exists($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg')) { - if (rename($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg', - $_SESSION['part_pics_dir'] . '/' .$_POST['NewStockID'].'.jpg')) { - echo ' ... ' . _('completed'); - } else { - echo ' ... ' . _('failed'); - } - } else { + + echo '<br />' . _('Changing stock location records'); + $sql = "UPDATE locstock SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock location records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); echo ' ... ' . _('completed'); - } - - echo '<br>' . _('Changing the item properties table records') . ' - ' . _('parents'); - $sql = "UPDATE stockitemproperties SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the item properties records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = 'SET FOREIGN_KEY_CHECKS=0'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - - echo '<BR>' . _('Changing work order requirements information'); - - $sql = "UPDATE worequirements SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockid worequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = "UPDATE worequirements SET parentstockid='" . $_POST['NewStockID'] . "' WHERE parentstockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the parent stockid worequirements records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - echo '<BR>' . _('Changing work order information'); - - $sql = "UPDATE woitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the woitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<br>' . _('Changing any serialised item information'); - - - $sql = "UPDATE stockserialitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockserialitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - $sql = "UPDATE stockserialmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to update the stockserialitem records failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - $sql = 'SET FOREIGN_KEY_CHECKS=1'; - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - - $result = DB_Txn_Commit($db); - - echo '<br>' . _('Deleting the old stock master record'); - $sql = "DELETE FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'"; - $ErrMsg = _('The SQL to delete the old stock master record failed'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - echo ' ... ' . _('completed'); - - - echo '<p>' . _('Stock Code') . ': ' . $_POST['OldStockID'] . ' ' . _('was successfully changed to') . ' : ' . $_POST['NewStockID']; - + + echo '<br />' . _('Changing stock movement records'); + $sql = "UPDATE stockmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock movement transaction records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing location transfer information'); + + $sql = "UPDATE loctransfers SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the loctransfers records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + + echo '<br />' . _('Changing MRP demands information'); + $sql = "UPDATE mrpdemands SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpdemands records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + //check if MRP tables exist before assuming + + $result = DB_query("SELECT COUNT(*) FROM mrpplannedorders",$db); + if ($DB_error_no==0) { + echo '<br />' . _('Changing MRP planned orders information'); + $sql = "UPDATE mrpplannedorders SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpplannedorders records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + + $result = DB_query("SELECT * FROM mrprequirements" , $db); + if (DB_error_no($db)==0){ + echo '<br />' . _('Changing MRP requirements information'); + $sql = "UPDATE mrprequirements SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrprequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + $result = DB_query("SELECT * FROM mrpsupplies" , $db); + if (DB_error_no($db)==0){ + echo '<br />' . _('Changing MRP supplies information'); + $sql = "UPDATE mrpsupplies SET part='" . $_POST['NewStockID'] . "' WHERE part='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the mrpsupplies records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + } + + echo '<br />' . _('Changing sales analysis records'); + $sql = "UPDATE salesanalysis SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update Sales Analysis records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing order delivery differences records'); + $sql = "UPDATE orderdeliverydifferenceslog SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update order delivery differences records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing pricing records'); + $sql = "UPDATE prices SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the pricing records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing sales orders detail records'); + $sql = "UPDATE salesorderdetails SET stkcode='" . $_POST['NewStockID'] . "' WHERE stkcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the sales order header records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing purchase order details records'); + $sql = "UPDATE purchorderdetails SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the purchase order detail records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing purchasing data records'); + $sql = "UPDATE purchdata SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the purchasing data records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock code in shipment charges records'); + $sql = "UPDATE shipmentcharges SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update Shipment Charges records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock check freeze file records'); + $sql = "UPDATE stockcheckfreeze SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock check freeze records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing the stock counts table records'); + $sql = "UPDATE stockcounts SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update stock counts records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the GRNs table records'); + $sql = "UPDATE grns SET itemcode='" . $_POST['NewStockID'] . "' WHERE itemcode='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update GRN records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the contract BOM table records'); + $sql = "UPDATE contractbom SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to contract BOM records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the BOM table records') . ' - ' . _('components'); + $sql = "UPDATE bom SET component='" . $_POST['NewStockID'] . "' WHERE component='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the BOM records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing the BOM table records') . ' - ' . _('parents'); + $sql = "UPDATE bom SET parent='" . $_POST['NewStockID'] . "' WHERE parent='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the BOM parent records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing any image files'); + if (file_exists($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg')) { + if (rename($_SESSION['part_pics_dir'] . '/' .$_POST['OldStockID'].'.jpg', + $_SESSION['part_pics_dir'] . '/' .$_POST['NewStockID'].'.jpg')) { + echo ' ... ' . _('completed'); + } else { + echo ' ... ' . _('failed'); + } + } else { + echo ' ... ' . _('completed'); + } + + echo '<br />' . _('Changing the item properties table records') . ' - ' . _('parents'); + $sql = "UPDATE stockitemproperties SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the item properties records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = 'SET FOREIGN_KEY_CHECKS=0'; + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + + echo '<br />' . _('Changing work order requirements information'); + + $sql = "UPDATE worequirements SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockid worequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = "UPDATE worequirements SET parentstockid='" . $_POST['NewStockID'] . "' WHERE parentstockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the parent stockid worequirements records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + echo '<br />' . _('Changing work order information'); + + $sql = "UPDATE woitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the woitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<br />' . _('Changing any serialised item information'); + + + $sql = "UPDATE stockserialitems SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockserialitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + $sql = "UPDATE stockserialmoves SET stockid='" . $_POST['NewStockID'] . "' WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to update the stockserialitem records failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + $sql = 'SET FOREIGN_KEY_CHECKS=1'; + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + + $result = DB_Txn_Commit($db); + + echo '<br />' . _('Deleting the old stock master record'); + $sql = "DELETE FROM stockmaster WHERE stockid='" . $_POST['OldStockID'] . "'"; + $ErrMsg = _('The SQL to delete the old stock master record failed'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + echo ' ... ' . _('completed'); + + + echo '<p>' . _('Stock Code') . ': ' . $_POST['OldStockID'] . ' ' . _('was successfully changed to') . ' : ' . $_POST['NewStockID']; + } //only do the stuff above if $InputError==0 + } -echo "<form action='" . $_SERVER['PHP_SELF'] . "?=" . $SID . "' method=post>"; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p><table> - <tr><td>' . _('Existing Inventory Code') . ":</td> - <td><input type=Text name='OldStockID' size=20 maxlength=20></td></tr>"; + <tr><td>' . _('Existing Inventory Code') . ':</td> + <td><input type=Text name="OldStockID" size=20 maxlength=20></td></tr>'; -echo '<tr><td>' . _('New Inventory Code') . ":</td><td><input type=Text name='NewStockID' size=20 maxlength=20></td></tr>"; +echo '<tr><td>' . _('New Inventory Code') . ':</td> + <td><input type="text" name="NewStockID" size=20 maxlength=20></td></tr>'; echo '</table>'; -echo "<div class=centre><input type=submit name='ProcessStockChange' VALUE='" . _('Process') . "'></div>"; +echo '<div class="centre"><input type="submit" name="ProcessStockChange" value="' . _('Process') . '"></div>'; echo '</form>'; Modified: trunk/build/make_release.sh =================================================================== --- trunk/build/make_release.sh 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/build/make_release.sh 2011-05-15 07:53:42 UTC (rev 4569) @@ -69,7 +69,7 @@ echo "SET FOREIGN_KEY_CHECKS = 0;" > $BASE_DIR/sql/mysql/weberp-new.sql -mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --create-options --skip-set-charset --no-data weberpdemo >> $BASE_DIR/sql/mysql/weberp-new.sql +mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --create-options --skip-set-charset --ignore-table=weberpdemo.mrpsupplies --ignore-table=weberpdemo.mrpplanedorders --ignore-table=weberpdemo.mrpparameters --ignore-table=weberpdemo.levels --ignore-table=weberpdemo.mrprequirements --ignore-table=weberpdemo.audittrail --no-data weberpdemo >> $BASE_DIR/sql/mysql/weberp-new.sql mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --no-create-info weberpdemo \ accountgroups \ @@ -101,10 +101,10 @@ accountsection \ > $BASE_DIR/sql/mysql/weberp-base.sql -mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --no-create-info weberpdemo > $BASE_DIR/sql/mysql/weberp-demo_data.sql +mysqldump -u$MYSQL_USER -p$MYSQL_PWD --skip-opt --skip-set-charset --quick --ignore-table=weberpdemo.mrpsupplies --ignore-table=weberpdemo.mrpplanedorders --ignore-table=weberpdemo.mrpparameters --ignore-table=weberpdemo.levels --ignore-table=weberpdemo.mrprequirements --no-create-info weberpdemo > $BASE_DIR/sql/mysql/weberp-demo_data.sql rm $BASE_DIR/sql/mysql/weberp-demo.sql -echo "CREATE DATABASE weberpdemo;" > $BASE_DIR/sql/mysql/weberp-demo.sql +echo "CREATE DATABASE IF NOT EXISTS weberpdemo;" > $BASE_DIR/sql/mysql/weberp-demo.sql echo "USE weberpdemo;" >> $BASE_DIR/sql/mysql/weberp-demo.sql cat $BASE_DIR/sql/mysql/weberp-new.sql >> $BASE_DIR/sql/mysql/weberp-demo.sql Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2011-05-15 07:12:43 UTC (rev 4568) +++ trunk/doc/Change.log 2011-05-15 07:53:42 UTC (rev 4569) @@ -1,6 +1,6 @@ webERP Change Log - +15/5/11 Z_ChangeStockCode.php modified to test if MRP tables exist before doing the updates 15/5/11 Tim: FixedAssetCategories prior to deletion of a category check for existing assets in the category failed due to typo in SQL - fixed 14/5/11 Tim: StockTransfer now checks for negative stock before allowing transfer - launchpad changes to 4691 14/5/11 CustomerInquiry.php now shows the currency decimal places This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-15 07:12:50
|
Revision: 4568 http://web-erp.svn.sourceforge.net/web-erp/?rev=4568&view=rev Author: daintree Date: 2011-05-15 07:12:43 +0000 (Sun, 15 May 2011) Log Message: ----------- lose the SalesInvoice.xml format Removed Paths: ------------- trunk/companies/weberpdemo/FormDesigns/SalesInvoice.xml Deleted: trunk/companies/weberpdemo/FormDesigns/SalesInvoice.xml =================================================================== --- trunk/companies/weberpdemo/FormDesigns/SalesInvoice.xml 2011-05-15 04:34:49 UTC (rev 4567) +++ trunk/companies/weberpdemo/FormDesigns/SalesInvoice.xml 2011-05-15 07:12:43 UTC (rev 4568) @@ -1,509 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<form name="Sales Invoice"> - <PaperSize name="Paper size">A4_Landscape</PaperSize> - <LineHeight name="Line height">16</LineHeight> - <logo type="image" name="Logo" id="Logo"> - <x>301</x> - <y>70</y> - <width>0</width> - <height>60</height> - </logo> - <Title type="SimpleText" name="Title" id="Title"> - <FontSize>15</FontSize> - <x>642</x> - <y>30</y> - </Title> - <BillingDetailBox type="CurvedRectangle" name="Billing detail box" id="BillingDetailBox"> - <x>567</x> - <y>61</y> - <width>225</width> - <height>88</height> - <radius>10</radius> - </BillingDetailBox> - <NumberCaption type="SimpleText" name="Number Caption" id="NumberCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>54</y> - </NumberCaption> - <InvoiceNumber type="SimpleText" name="Invoice Number" id="InvoiceNumber"> - <FontSize>10</FontSize> - <x>662</x> - <y>54</y> - </InvoiceNumber> - <CodeCaption type="SimpleText" name="Code Caption" id="CodeCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>67</y> - </CodeCaption> - <CustomerCode type="SimpleText" name="Customer Code" id="CustomerCode"> - <FontSize>10</FontSize> - <x>662</x> - <y>67</y> - </CustomerCode> - <DateCaption type="SimpleText" name="Date Caption" id="DateCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>80</y> - </DateCaption> - <Date type="SimpleText" name="Date" id="Date"> - <FontSize>10</FontSize> - <x>662</x> - <y>80</y> - </Date> - <OrderNumberCaption type="SimpleText" name="Order Number Caption" id="OrderNumberCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>93</y> - </OrderNumberCaption> - <OrderNumber type="SimpleText" name="Order Number" id="OrderNumber"> - <FontSize>10</FontSize> - <x>662</x> - <y>93</y> - </OrderNumber> - <OrderDateCaption type="SimpleText" name="Order Date Caption" id="OrderDateCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>106</y> - </OrderDateCaption> - <OrderDate type="SimpleText" name="Order Date" id="OrderDate"> - <FontSize>10</FontSize> - <x>662</x> - <y>106</y> - </OrderDate> - <ShipperCaption type="SimpleText" name="Shipper Caption" id="ShipperCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>119</y> - </ShipperCaption> - <ShipperName type="SimpleText" name="Shipper Name" id="ShipperName"> - <FontSize>10</FontSize> - <x>662</x> - <y>119</y> - </ShipperName> - <LocationCaption type="SimpleText" name="Location Caption" id="LocationCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>132</y> - </LocationCaption> - <Location type="SimpleText" name="Location" id="Location"> - <FontSize>10</FontSize> - <x>662</x> - <y>132</y> - </Location> - <PageNumberCaption type="SimpleText" name="Page Number Caption" id="PageNumberCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>145</y> - </PageNumberCaption> - <PageNumber type="SimpleText" name="Page Number" id="PageNumber"> - <FontSize>10</FontSize> - <x>662</x> - <y>145</y> - </PageNumber> - <CompanyName type="SimpleText" name="Company name" id="CompanyName"> - <FontSize>10</FontSize> - <x>331</x> - <y>75</y> - </CompanyName> - <TaxReference type="SimpleText" name="Tax Reference" id="TaxReference"> - <FontSize>8</FontSize> - <x>331</x> - <y>85</y> - </TaxReference> - <CompanyAddress type="ElementArray" name="Company address"> - <Line1 type="SimpleText" name="Line 1" id="CompanyAddress1"> - <FontSize>8</FontSize> - <x>331</x> - <y>94</y> - </Line1> - <Line2 type="SimpleText" name="Line 2" id="CompanyAddress2"> - <FontSize>8</FontSize> - <x>331</x> - <y>102</y> - </Line2> - <Line3 type="SimpleText" name="Line 3" id="CompanyAddress3"> - <FontSize>8</FontSize> - <x>331</x> - <y>110</y> - </Line3> - <Line4 type="SimpleText" name="Line 4" id="CompanyAddress4"> - <FontSize>8</FontSize> - <x>331</x> - <y>118</y> - </Line4> - <Line5 type="SimpleText" name="Line 5" id="CompanyAddress5"> - <FontSize>8</FontSize> - <x>331</x> - <y>126</y> - </Line5> - <Line6 type="SimpleText" name="Line 6" id="CompanyAddress6"> - <FontSize>8</FontSize> - <x>331</x> - <y>135</y> - </Line6> - </CompanyAddress> - <CompanyPhone type="SimpleText" name="Company phone number" id="CompanyPhone"> - <FontSize>8</FontSize> - <x>331</x> - <y>144</y> - </CompanyPhone> - <CompanyFax type="SimpleText" name="Company fax number" id="CompanyFax"> - <FontSize>8</FontSize> - <x>431</x> - <y>144</y> - </CompanyFax> - <CompanyEmail type="SimpleText" name="Company email address" id="CompanyEmail"> - <FontSize>8</FontSize> - <x>331</x> - <y>153</y> - </CompanyEmail> - <InvoiceAddressCaption type="SimpleText" name="Invoice Address Caption" id="InvoiceAddressCaption"> - <FontSize>10</FontSize> - <x>40</x> - <y>30</y> - </InvoiceAddressCaption> - <InvoiceAddressName type="SimpleText" name="Invoice Address Name" id="InvoiceAddressName"> - <FontSize>10</FontSize> - <x>120</x> - <y>30</y> - </InvoiceAddressName> - <InvoiceAddress type="ElementArray" name="Invoice address"> - <Line1 type="SimpleText" name="Line 1" id="InvoiceAddress1"> - <FontSize>10</FontSize> - <x>120</x> - <y>44</y> - </Line1> - <Line2 type="SimpleText" name="Line 2" id="InvoiceAddress2"> - <FontSize>10</FontSize> - <x>120</x> - <y>58</y> - </Line2> - <Line3 type="SimpleText" name="Line 3" id="InvoiceAddress3"> - <FontSize>10</FontSize> - <x>120</x> - <y>72</y> - </Line3> - <Line4 type="SimpleText" name="Line 4" id="InvoiceAddress4"> - <FontSize>10</FontSize> - <x>170</x> - <y>72</y> - </Line4> - <Line5 type="SimpleText" name="Line 5" id="InvoiceAddress"> - <FontSize>10</FontSize> - <x>220</x> - <y>72</y> - </Line5> - <Line6 type="SimpleText" name="Line 6" id="InvoiceAddress6"> - <FontSize>10</FontSize> - <x>270</x> - <y>72</y> - </Line6> - </InvoiceAddress> - <DeliveryAddressCaption type="SimpleText" name="Delivery Address Caption" id="DeliveryAddressCaption"> - <FontSize>10</FontSize> - <x>40</x> - <y>94</y> - </DeliveryAddressCaption> - <DeliveryAddressName type="SimpleText" name="Delivery Address Name" id="DeliveryAddressName"> - <FontSize>10</FontSize> - <x>120</x> - <y>94</y> - </DeliveryAddressName> - <DeliveryAddress type="ElementArray" name="Delivery address"> - <Line1 type="SimpleText" name="Line 1" id="Line1"> - <FontSize>10</FontSize> - <x>120</x> - <y>108</y> - </Line1> - <Line2 type="SimpleText" name="Line 2" id="Line2"> - <FontSize>10</FontSize> - <x>120</x> - <y>122</y> - </Line2> - <Line3 type="SimpleText" name="Line 3" id="Line3"> - <FontSize>10</FontSize> - <x>120</x> - <y>136</y> - </Line3> - <Line4 type="SimpleText" name="Line 4" id="Line4"> - <FontSize>10</FontSize> - <x>170</x> - <y>136</y> - </Line4> - <Line5 type="SimpleText" name="Line 5" id="Line5"> - <FontSize>10</FontSize> - <x>220</x> - <y>136</y> - </Line5> - <Line6 type="SimpleText" name="Line 6" id="Line6"> - <FontSize>10</FontSize> - <x>270</x> - <y>136</y> - </Line6> - </DeliveryAddress> - <Currency type="SimpleText" name="Currency text" id="Currency"> - <FontSize>10</FontSize> - <x>40</x> - <y>150</y> - </Currency> - <MainOutputBox type="CurvedRectangle" name="Main Output Box" id="MainOutputBox"> - <x>40</x> - <y>176</y> - <width>762</width> - <height>390</height> - <radius>10</radius> - </MainOutputBox> - <CustomerTaxReferenceCaption type="SimpleText" name="Customer Tax Reference Caption" id="CustomerTaxReferenceCaption"> - <FontSize>10</FontSize> - <x>44</x> - <y>166</y> - </CustomerTaxReferenceCaption> - <CustomerTaxReference type="SimpleText" name="Customer Tax Reference" id="CustomerTaxReference"> - <FontSize>10</FontSize> - <x>130</x> - <y>166</y> - </CustomerTaxReference> - <OrderRefLine type="Line" name="Order Reference Line" id="OrderRefLine"> - <startx>288</startx> - <starty>165</starty> - <endx>288</endx> - <endy>182</endy> - </OrderRefLine> - <CustomerOrderReferenceCaption type="SimpleText" name="Customer Order Reference Caption" id="CustomerOrderReferenceCaption"> - <FontSize>10</FontSize> - <x>290</x> - <y>166</y> - </CustomerOrderReferenceCaption> - <CustomerOrderReference type="SimpleText" name="Customer Order Reference" id="CustomerOrderReference"> - <FontSize>10</FontSize> - <x>388</x> - <y>166</y> - </CustomerOrderReference> - <SalesmanLine type="Line" name="Salesman Line" id="SalesmanLine"> - <startx>490</startx> - <starty>165</starty> - <endx>490</endx> - <endy>182</endy> - </SalesmanLine> - <SalesmanReferenceCaption type="SimpleText" name="Salesman Reference Caption" id="SalesmanReferenceCaption"> - <FontSize>10</FontSize> - <x>493</x> - <y>166</y> - </SalesmanReferenceCaption> - <SalesmanReference type="SimpleText" name="Salesman Reference" id="SalesmanReference"> - <FontSize>10</FontSize> - <x>570</x> - <y>166</y> - </SalesmanReference> - <LineAboveColumns type="Line" name="Line Above Columns" id="LineAboveColumns"> - <startx>40</startx> - <starty>182</starty> - <endx>812</endx> - <endy>182</endy> - </LineAboveColumns> - <LineBelowColumns type="Line" name="Line Below Columns" id="LineBelowColumns"> - <startx>40</startx> - <starty>202</starty> - <endx>812</endx> - <endy>202</endy> - </LineBelowColumns> - <Headings type="ElementArray" name="Column headings"> - <Column1 type="SimpleText" name="Heading 1" id="Heading1"> - <FontSize>10</FontSize> - <x>44</x> - <y>184</y> - </Column1> - <Column2 type="SimpleText" name="Heading 2" id="Heading2"> - <FontSize>10</FontSize> - <x>140</x> - <y>184</y> - </Column2> - <Column3 type="SimpleText" name="Heading 3" id="Heading3"> - <FontSize>10</FontSize> - <x>431</x> - <y>184</y> - </Column3> - <Column4 type="SimpleText" name="Heading 4" id="Heading4"> - <FontSize>10</FontSize> - <x>541</x> - <y>184</y> - </Column4> - <Column5 type="SimpleText" name="Heading 5" id="Heading5"> - <FontSize>10</FontSize> - <x>596</x> - <y>184</y> - </Column5> - <Column6 type="SimpleText" name="Heading 6" id="Heading6"> - <FontSize>10</FontSize> - <x>631</x> - <y>184</y> - </Column6> - <Column7 type="SimpleText" name="Heading 7" id="Heading7"> - <FontSize>10</FontSize> - <x>731</x> - <y>184</y> - </Column7> - </Headings> - <Data type="ElementArray" name="Column Data"> - <y type="StartLine" name="Y co-ordinate of first data line" id="DataStartLine">214</y> - <Column1 type="DataText" name="Column 1" id="Data1"> - <FontSize>10</FontSize> - <x>43</x> - <Length>95</Length> - </Column1> - <Column2 type="DataText" name="Column 2" id="Data2"> - <FontSize>10</FontSize> - <x>140</x> - <Length>245</Length> - </Column2> - <Column3 type="DataText" name="Column 3" id="Data3"> - <FontSize>10</FontSize> - <x>393</x> - <Length>96</Length> - </Column3> - <Column4 type="DataText" name="Column 4" id="Data4"> - <FontSize>10</FontSize> - <x>493</x> - <Length>96</Length> - </Column4> - <Column5 type="DataText" name="Column 5" id="Data5"> - <FontSize>10</FontSize> - <x>593</x> - <Length>35</Length> - </Column5> - <Column6 type="DataText" name="Column 6" id="Data6"> - <FontSize>10</FontSize> - <x>630</x> - <Length>50</Length> - </Column6> - <Column7 type="DataText" name="Column 7" id="Data7"> - <FontSize>10</FontSize> - <x>682</x> - <Length>120</Length> - </Column7> - </Data> - <DataLines type="ElementArray" name="Column Lines"> - <Line1 type="Line" name="Line 1" id="Line1"> - <startx>137</startx> - <starty>182</starty> - <endx>137</endx> - <endy>501</endy> - </Line1> - <Line2 type="Line" name="Line 2" id="Line2"> - <startx>390</startx> - <starty>182</starty> - <endx>390</endx> - <endy>501</endy> - </Line2> - <Line3 type="Line" name="Line 3" id="Line3"> - <startx>490</startx> - <starty>182</starty> - <endx>490</endx> - <endy>501</endy> - </Line3> - <Line4 type="Line" name="Line 4" id="Line4"> - <startx>590</startx> - <starty>182</starty> - <endx>590</endx> - <endy>501</endy> - </Line4> - <Line5 type="Line" name="Line 5" id="Line5"> - <startx>627</startx> - <starty>182</starty> - <endx>627</endx> - <endy>501</endy> - </Line5> - <Line6 type="Line" name="Line 6" id="Line6"> - <startx>680</startx> - <starty>182</starty> - <endx>680</endx> - <endy>501</endy> - </Line6> - </DataLines> - <LineAboveFooter type="Line" name="Line Above Footer" id="LineAboveFooter"> - <startx>40</startx> - <starty>501</starty> - <endx>812</endx> - <endy>501</endy> - </LineAboveFooter> - <PaymentTerms type="MultiLineText" name="Payment Terms" id="PaymentTerms"> - <FontSize>8</FontSize> - <x>45</x> - <y>512</y> - <Length>280</Length> - </PaymentTerms> - <InvoiceText type="MultiLineText" name="Invoice Text" id="InvoiceText"> - <FontSize>8</FontSize> - <x>45</x> - <y>532</y> - <Length>280</Length> - </InvoiceText> - <SubTotalCaption type="SimpleText" name="Sub-Total Caption" id="SubTotalCaption"> - <FontSize>10</FontSize> - <x>592</x> - <y>502</y> - </SubTotalCaption> - <SubTotal type="MultiLineText" name="Sub-Total" id="SubTotal"> - <FontSize>10</FontSize> - <x>682</x> - <y>512</y> - <Length>120</Length> - </SubTotal> - <FreightCaption type="SimpleText" name="Freight Caption" id="FreightCaption"> - <FontSize>10</FontSize> - <x>592</x> - <y>518</y> - </FreightCaption> - <Freight type="MultiLineText" name="Freight" id="Freight"> - <FontSize>10</FontSize> - <x>682</x> - <y>528</y> - <Length>120</Length> - </Freight> - <TaxCaption type="SimpleText" name="Tax Caption" id="TaxCaption"> - <FontSize>10</FontSize> - <x>592</x> - <y>534</y> - </TaxCaption> - <Tax type="MultiLineText" name="Tax" id="Tax"> - <FontSize>10</FontSize> - <x>682</x> - <y>544</y> - <Length>120</Length> - </Tax> - <TotalLine type="Line" name="Total Line" id="TotalLine"> - <startx>590</startx> - <starty>549</starty> - <endx>812</endx> - <endy>549</endy> - </TotalLine> - <RomalpaLine type="Line" name="Romalpa Line" id="RomalpaLine"> - <startx>590</startx> - <starty>500</starty> - <endx>590</endx> - <endy>575</endy> - </RomalpaLine> - <TotalCaption type="SimpleText" name="Total Caption" id="TotalCaption"> - <FontSize>10</FontSize> - <x>592</x> - <y>550</y> - </TotalCaption> - <Total type="MultiLineText" name="Total" id="Total"> - <FontSize>10</FontSize> - <x>682</x> - <y>560</y> - <Length>120</Length> - </Total> - <Romalpa type="MultiLineText" name="Romalpa" id="Romalpa"> - <FontSize>9</FontSize> - <x>340</x> - <y>512</y> - <Length>195</Length> - </Romalpa> - <CreditCardLogo type="image" name="Credit Card Logo" id="CreditCardLogo"> - <x>320</x> - <y>555</y> - <width>0</width> - <height>30</height> - </CreditCardLogo> -</form> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-15 07:12:50
|
Revision: 4568 http://web-erp.svn.sourceforge.net/web-erp/?rev=4568&view=rev Author: daintree Date: 2011-05-15 07:12:43 +0000 (Sun, 15 May 2011) Log Message: ----------- lose the SalesInvoice.xml format Removed Paths: ------------- trunk/companies/weberpdemo/FormDesigns/SalesInvoice.xml Deleted: trunk/companies/weberpdemo/FormDesigns/SalesInvoice.xml =================================================================== --- trunk/companies/weberpdemo/FormDesigns/SalesInvoice.xml 2011-05-15 04:34:49 UTC (rev 4567) +++ trunk/companies/weberpdemo/FormDesigns/SalesInvoice.xml 2011-05-15 07:12:43 UTC (rev 4568) @@ -1,509 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<form name="Sales Invoice"> - <PaperSize name="Paper size">A4_Landscape</PaperSize> - <LineHeight name="Line height">16</LineHeight> - <logo type="image" name="Logo" id="Logo"> - <x>301</x> - <y>70</y> - <width>0</width> - <height>60</height> - </logo> - <Title type="SimpleText" name="Title" id="Title"> - <FontSize>15</FontSize> - <x>642</x> - <y>30</y> - </Title> - <BillingDetailBox type="CurvedRectangle" name="Billing detail box" id="BillingDetailBox"> - <x>567</x> - <y>61</y> - <width>225</width> - <height>88</height> - <radius>10</radius> - </BillingDetailBox> - <NumberCaption type="SimpleText" name="Number Caption" id="NumberCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>54</y> - </NumberCaption> - <InvoiceNumber type="SimpleText" name="Invoice Number" id="InvoiceNumber"> - <FontSize>10</FontSize> - <x>662</x> - <y>54</y> - </InvoiceNumber> - <CodeCaption type="SimpleText" name="Code Caption" id="CodeCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>67</y> - </CodeCaption> - <CustomerCode type="SimpleText" name="Customer Code" id="CustomerCode"> - <FontSize>10</FontSize> - <x>662</x> - <y>67</y> - </CustomerCode> - <DateCaption type="SimpleText" name="Date Caption" id="DateCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>80</y> - </DateCaption> - <Date type="SimpleText" name="Date" id="Date"> - <FontSize>10</FontSize> - <x>662</x> - <y>80</y> - </Date> - <OrderNumberCaption type="SimpleText" name="Order Number Caption" id="OrderNumberCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>93</y> - </OrderNumberCaption> - <OrderNumber type="SimpleText" name="Order Number" id="OrderNumber"> - <FontSize>10</FontSize> - <x>662</x> - <y>93</y> - </OrderNumber> - <OrderDateCaption type="SimpleText" name="Order Date Caption" id="OrderDateCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>106</y> - </OrderDateCaption> - <OrderDate type="SimpleText" name="Order Date" id="OrderDate"> - <FontSize>10</FontSize> - <x>662</x> - <y>106</y> - </OrderDate> - <ShipperCaption type="SimpleText" name="Shipper Caption" id="ShipperCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>119</y> - </ShipperCaption> - <ShipperName type="SimpleText" name="Shipper Name" id="ShipperName"> - <FontSize>10</FontSize> - <x>662</x> - <y>119</y> - </ShipperName> - <LocationCaption type="SimpleText" name="Location Caption" id="LocationCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>132</y> - </LocationCaption> - <Location type="SimpleText" name="Location" id="Location"> - <FontSize>10</FontSize> - <x>662</x> - <y>132</y> - </Location> - <PageNumberCaption type="SimpleText" name="Page Number Caption" id="PageNumberCaption"> - <FontSize>10</FontSize> - <x>574</x> - <y>145</y> - </PageNumberCaption> - <PageNumber type="SimpleText" name="Page Number" id="PageNumber"> - <FontSize>10</FontSize> - <x>662</x> - <y>145</y> - </PageNumber> - <CompanyName type="SimpleText" name="Company name" id="CompanyName"> - <FontSize>10</FontSize> - <x>331</x> - <y>75</y> - </CompanyName> - <TaxReference type="SimpleText" name="Tax Reference" id="TaxReference"> - <FontSize>8</FontSize> - <x>331</x> - <y>85</y> - </TaxReference> - <CompanyAddress type="ElementArray" name="Company address"> - <Line1 type="SimpleText" name="Line 1" id="CompanyAddress1"> - <FontSize>8</FontSize> - <x>331</x> - <y>94</y> - </Line1> - <Line2 type="SimpleText" name="Line 2" id="CompanyAddress2"> - <FontSize>8</FontSize> - <x>331</x> - <y>102</y> - </Line2> - <Line3 type="SimpleText" name="Line 3" id="CompanyAddress3"> - <FontSize>8</FontSize> - <x>331</x> - <y>110</y> - </Line3> - <Line4 type="SimpleText" name="Line 4" id="CompanyAddress4"> - <FontSize>8</FontSize> - <x>331</x> - <y>118</y> - </Line4> - <Line5 type="SimpleText" name="Line 5" id="CompanyAddress5"> - <FontSize>8</FontSize> - <x>331</x> - <y>126</y> - </Line5> - <Line6 type="SimpleText" name="Line 6" id="CompanyAddress6"> - <FontSize>8</FontSize> - <x>331</x> - <y>135</y> - </Line6> - </CompanyAddress> - <CompanyPhone type="SimpleText" name="Company phone number" id="CompanyPhone"> - <FontSize>8</FontSize> - <x>331</x> - <y>144</y> - </CompanyPhone> - <CompanyFax type="SimpleText" name="Company fax number" id="CompanyFax"> - <FontSize>8</FontSize> - <x>431</x> - <y>144</y> - </CompanyFax> - <CompanyEmail type="SimpleText" name="Company email address" id="CompanyEmail"> - <FontSize>8</FontSize> - <x>331</x> - <y>153</y> - </CompanyEmail> - <InvoiceAddressCaption type="SimpleText" name="Invoice Address Caption" id="InvoiceAddressCaption"> - <FontSize>10</FontSize> - <x>40</x> - <y>30</y> - </InvoiceAddressCaption> - <InvoiceAddressName type="SimpleText" name="Invoice Address Name" id="InvoiceAddressName"> - <FontSize>10</FontSize> - <x>120</x> - <y>30</y> - </InvoiceAddressName> - <InvoiceAddress type="ElementArray" name="Invoice address"> - <Line1 type="SimpleText" name="Line 1" id="InvoiceAddress1"> - <FontSize>10</FontSize> - <x>120</x> - <y>44</y> - </Line1> - <Line2 type="SimpleText" name="Line 2" id="InvoiceAddress2"> - <FontSize>10</FontSize> - <x>120</x> - <y>58</y> - </Line2> - <Line3 type="SimpleText" name="Line 3" id="InvoiceAddress3"> - <FontSize>10</FontSize> - <x>120</x> - <y>72</y> - </Line3> - <Line4 type="SimpleText" name="Line 4" id="InvoiceAddress4"> - <FontSize>10</FontSize> - <x>170</x> - <y>72</y> - </Line4> - <Line5 type="SimpleText" name="Line 5" id="InvoiceAddress"> - <FontSize>10</FontSize> - <x>220</x> - <y>72</y> - </Line5> - <Line6 type="SimpleText" name="Line 6" id="InvoiceAddress6"> - <FontSize>10</FontSize> - <x>270</x> - <y>72</y> - </Line6> - </InvoiceAddress> - <DeliveryAddressCaption type="SimpleText" name="Delivery Address Caption" id="DeliveryAddressCaption"> - <FontSize>10</FontSize> - <x>40</x> - <y>94</y> - </DeliveryAddressCaption> - <DeliveryAddressName type="SimpleText" name="Delivery Address Name" id="DeliveryAddressName"> - <FontSize>10</FontSize> - <x>120</x> - <y>94</y> - </DeliveryAddressName> - <DeliveryAddress type="ElementArray" name="Delivery address"> - <Line1 type="SimpleText" name="Line 1" id="Line1"> - <FontSize>10</FontSize> - <x>120</x> - <y>108</y> - </Line1> - <Line2 type="SimpleText" name="Line 2" id="Line2"> - <FontSize>10</FontSize> - <x>120</x> - <y>122</y> - </Line2> - <Line3 type="SimpleText" name="Line 3" id="Line3"> - <FontSize>10</FontSize> - <x>120</x> - <y>136</y> - </Line3> - <Line4 type="SimpleText" name="Line 4" id="Line4"> - <FontSize>10</FontSize> - <x>170</x> - <y>136</y> - </Line4> - <Line5 type="SimpleText" name="Line 5" id="Line5"> - <FontSize>10</FontSize> - <x>220</x> - <y>136</y> - </Line5> - <Line6 type="SimpleText" name="Line 6" id="Line6"> - <FontSize>10</FontSize> - <x>270</x> - <y>136</y> - </Line6> - </DeliveryAddress> - <Currency type="SimpleText" name="Currency text" id="Currency"> - <FontSize>10</FontSize> - <x>40</x> - <y>150</y> - </Currency> - <MainOutputBox type="CurvedRectangle" name="Main Output Box" id="MainOutputBox"> - <x>40</x> - <y>176</y> - <width>762</width> - <height>390</height> - <radius>10</radius> - </MainOutputBox> - <CustomerTaxReferenceCaption type="SimpleText" name="Customer Tax Reference Caption" id="CustomerTaxReferenceCaption"> - <FontSize>10</FontSize> - <x>44</x> - <y>166</y> - </CustomerTaxReferenceCaption> - <CustomerTaxReference type="SimpleText" name="Customer Tax Reference" id="CustomerTaxReference"> - <FontSize>10</FontSize> - <x>130</x> - <y>166</y> - </CustomerTaxReference> - <OrderRefLine type="Line" name="Order Reference Line" id="OrderRefLine"> - <startx>288</startx> - <starty>165</starty> - <endx>288</endx> - <endy>182</endy> - </OrderRefLine> - <CustomerOrderReferenceCaption type="SimpleText" name="Customer Order Reference Caption" id="CustomerOrderReferenceCaption"> - <FontSize>10</FontSize> - <x>290</x> - <y>166</y> - </CustomerOrderReferenceCaption> - <CustomerOrderReference type="SimpleText" name="Customer Order Reference" id="CustomerOrderReference"> - <FontSize>10</FontSize> - <x>388</x> - <y>166</y> - </CustomerOrderReference> - <SalesmanLine type="Line" name="Salesman Line" id="SalesmanLine"> - <startx>490</startx> - <starty>165</starty> - <endx>490</endx> - <endy>182</endy> - </SalesmanLine> - <SalesmanReferenceCaption type="SimpleText" name="Salesman Reference Caption" id="SalesmanReferenceCaption"> - <FontSize>10</FontSize> - <x>493</x> - <y>166</y> - </SalesmanReferenceCaption> - <SalesmanReference type="SimpleText" name="Salesman Reference" id="SalesmanReference"> - <FontSize>10</FontSize> - <x>570</x> - <y>166</y> - </SalesmanReference> - <LineAboveColumns type="Line" name="Line Above Columns" id="LineAboveColumns"> - <startx>40</startx> - <starty>182</starty> - <endx>812</endx> - <endy>182</endy> - </LineAboveColumns> - <LineBelowColumns type="Line" name="Line Below Columns" id="LineBelowColumns"> - <startx>40</startx> - <starty>202</starty> - <endx>812</endx> - <endy>202</endy> - </LineBelowColumns> - <Headings type="ElementArray" name="Column headings"> - <Column1 type="SimpleText" name="Heading 1" id="Heading1"> - <FontSize>10</FontSize> - <x>44</x> - <y>184</y> - </Column1> - <Column2 type="SimpleText" name="Heading 2" id="Heading2"> - <FontSize>10</FontSize> - <x>140</x> - <y>184</y> - </Column2> - <Column3 type="SimpleText" name="Heading 3" id="Heading3"> - <FontSize>10</FontSize> - <x>431</x> - <y>184</y> - </Column3> - <Column4 type="SimpleText" name="Heading 4" id="Heading4"> - <FontSize>10</FontSize> - <x>541</x> - <y>184</y> - </Column4> - <Column5 type="SimpleText" name="Heading 5" id="Heading5"> - <FontSize>10</FontSize> - <x>596</x> - <y>184</y> - </Column5> - <Column6 type="SimpleText" name="Heading 6" id="Heading6"> - <FontSize>10</FontSize> - <x>631</x> - <y>184</y> - </Column6> - <Column7 type="SimpleText" name="Heading 7" id="Heading7"> - <FontSize>10</FontSize> - <x>731</x> - <y>184</y> - </Column7> - </Headings> - <Data type="ElementArray" name="Column Data"> - <y type="StartLine" name="Y co-ordinate of first data line" id="DataStartLine">214</y> - <Column1 type="DataText" name="Column 1" id="Data1"> - <FontSize>10</FontSize> - <x>43</x> - <Length>95</Length> - </Column1> - <Column2 type="DataText" name="Column 2" id="Data2"> - <FontSize>10</FontSize> - <x>140</x> - <Length>245</Length> - </Column2> - <Column3 type="DataText" name="Column 3" id="Data3"> - <FontSize>10</FontSize> - <x>393</x> - <Length>96</Length> - </Column3> - <Column4 type="DataText" name="Column 4" id="Data4"> - <FontSize>10</FontSize> - <x>493</x> - <Length>96</Length> - </Column4> - <Column5 type="DataText" name="Column 5" id="Data5"> - <FontSize>10</FontSize> - <x>593</x> - <Length>35</Length> - </Column5> - <Column6 type="DataText" name="Column 6" id="Data6"> - <FontSize>10</FontSize> - <x>630</x> - <Length>50</Length> - </Column6> - <Column7 type="DataText" name="Column 7" id="Data7"> - <FontSize>10</FontSize> - <x>682</x> - <Length>120</Length> - </Column7> - </Data> - <DataLines type="ElementArray" name="Column Lines"> - <Line1 type="Line" name="Line 1" id="Line1"> - <startx>137</startx> - <starty>182</starty> - <endx>137</endx> - <endy>501</endy> - </Line1> - <Line2 type="Line" name="Line 2" id="Line2"> - <startx>390</startx> - <starty>182</starty> - <endx>390</endx> - <endy>501</endy> - </Line2> - <Line3 type="Line" name="Line 3" id="Line3"> - <startx>490</startx> - <starty>182</starty> - <endx>490</endx> - <endy>501</endy> - </Line3> - <Line4 type="Line" name="Line 4" id="Line4"> - <startx>590</startx> - <starty>182</starty> - <endx>590</endx> - <endy>501</endy> - </Line4> - <Line5 type="Line" name="Line 5" id="Line5"> - <startx>627</startx> - <starty>182</starty> - <endx>627</endx> - <endy>501</endy> - </Line5> - <Line6 type="Line" name="Line 6" id="Line6"> - <startx>680</startx> - <starty>182</starty> - <endx>680</endx> - <endy>501</endy> - </Line6> - </DataLines> - <LineAboveFooter type="Line" name="Line Above Footer" id="LineAboveFooter"> - <startx>40</startx> - <starty>501</starty> - <endx>812</endx> - <endy>501</endy> - </LineAboveFooter> - <PaymentTerms type="MultiLineText" name="Payment Terms" id="PaymentTerms"> - <FontSize>8</FontSize> - <x>45</x> - <y>512</y> - <Length>280</Length> - </PaymentTerms> - <InvoiceText type="MultiLineText" name="Invoice Text" id="InvoiceText"> - <FontSize>8</FontSize> - <x>45</x> - <y>532</y> - <Length>280</Length> - </InvoiceText> - <SubTotalCaption type="SimpleText" name="Sub-Total Caption" id="SubTotalCaption"> - <FontSize>10</FontSize> - <x>592</x> - <y>502</y> - </SubTotalCaption> - <SubTotal type="MultiLineText" name="Sub-Total" id="SubTotal"> - <FontSize>10</FontSize> - <x>682</x> - <y>512</y> - <Length>120</Length> - </SubTotal> - <FreightCaption type="SimpleText" name="Freight Caption" id="FreightCaption"> - <FontSize>10</FontSize> - <x>592</x> - <y>518</y> - </FreightCaption> - <Freight type="MultiLineText" name="Freight" id="Freight"> - <FontSize>10</FontSize> - <x>682</x> - <y>528</y> - <Length>120</Length> - </Freight> - <TaxCaption type="SimpleText" name="Tax Caption" id="TaxCaption"> - <FontSize>10</FontSize> - <x>592</x> - <y>534</y> - </TaxCaption> - <Tax type="MultiLineText" name="Tax" id="Tax"> - <FontSize>10</FontSize> - <x>682</x> - <y>544</y> - <Length>120</Length> - </Tax> - <TotalLine type="Line" name="Total Line" id="TotalLine"> - <startx>590</startx> - <starty>549</starty> - <endx>812</endx> - <endy>549</endy> - </TotalLine> - <RomalpaLine type="Line" name="Romalpa Line" id="RomalpaLine"> - <startx>590</startx> - <starty>500</starty> - <endx>590</endx> - <endy>575</endy> - </RomalpaLine> - <TotalCaption type="SimpleText" name="Total Caption" id="TotalCaption"> - <FontSize>10</FontSize> - <x>592</x> - <y>550</y> - </TotalCaption> - <Total type="MultiLineText" name="Total" id="Total"> - <FontSize>10</FontSize> - <x>682</x> - <y>560</y> - <Length>120</Length> - </Total> - <Romalpa type="MultiLineText" name="Romalpa" id="Romalpa"> - <FontSize>9</FontSize> - <x>340</x> - <y>512</y> - <Length>195</Length> - </Romalpa> - <CreditCardLogo type="image" name="Credit Card Logo" id="CreditCardLogo"> - <x>320</x> - <y>555</y> - <width>0</width> - <height>30</height> - </CreditCardLogo> -</form> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-15 04:34:58
|
Revision: 4567 http://web-erp.svn.sourceforge.net/web-erp/?rev=4567&view=rev Author: daintree Date: 2011-05-15 04:34:49 +0000 (Sun, 15 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/FixedAssetCategories.php trunk/Logout.php trunk/PO_AuthorisationLevels.php trunk/PO_Header.php trunk/PcAssignCashToTab.php trunk/PcAuthorizeExpenses.php trunk/PcClaimExpensesFromTab.php trunk/PcExpenses.php trunk/PcExpensesTypeTab.php trunk/PcReportTab.php trunk/PcTabs.php trunk/PcTypeTabs.php trunk/UnitsOfMeasure.php trunk/doc/Change.log trunk/includes/Login.php Modified: trunk/FixedAssetCategories.php =================================================================== --- trunk/FixedAssetCategories.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/FixedAssetCategories.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -50,10 +50,9 @@ $InputError =1; } /*Make an array of the defined bank accounts */ - $SQL = 'SELECT bankaccounts.accountcode - FROM bankaccounts, - chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + $SQL = "SELECT bankaccounts.accountcode + FROM bankaccounts INNER JOIN chartmaster + ON bankaccounts.accountcode=chartmaster.accountcode"; $result = DB_query($SQL,$db); $BankAccounts = array(); $i=0; @@ -123,7 +122,7 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'fixedassets' - $sql= "SELECT COUNT(*) FROM fixedasset WHERE fixedassets.assetcategoryid='" . $SelectedCategory . "'"; + $sql= "SELECT COUNT(*) FROM fixedassets WHERE fixedassets.assetcategoryid='" . $SelectedCategory . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/Logout.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -23,7 +23,7 @@ <?php echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; ?> - <span><?php echo _('Thank you for using webERP'); ?></span> + <span><?php echo _('Thank you for using webERP'); ?></span> <br /> <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> </form> Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PO_AuthorisationLevels.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -8,18 +8,21 @@ include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/group_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; -$User=''; -$Currency=''; -$CanCreate=1; -$OffHold=1; -$AuthLevel=0; + + +/*Note: If CanCreate==0 then this means the user can create orders + * Also if OffHold==0 then the user can release purchase invocies + * This logic confused me a bit to start with + */ + + if (isset($_POST['Submit'])) { - if (isset($_POST['CanCreate']) and $_POST['CanCreate']=='on') { + if (isset($_POST['CanCreate']) AND $_POST['CanCreate']=='on') { $CanCreate=0; } else { $CanCreate=1; } - if (isset($_POST['OffHold']) and $_POST['OffHold']=='on') { + if (isset($_POST['OffHold']) AND $_POST['OffHold']=='on') { $OffHold=0; } else { $OffHold=1; @@ -48,17 +51,17 @@ $Result=DB_query($sql,$db,$ErrMsg); } else { prnMsg(_('There already exists an entry for this user/currency combination'), 'error'); - echo '<br />'; + echo '<br />'; } } if (isset($_POST['Update'])) { - if (isset($_POST['CanCreate']) and $_POST['CanCreate']=='on') { + if (isset($_POST['CanCreate']) AND $_POST['CanCreate']=='on') { $CanCreate=0; } else { $CanCreate=1; } - if (isset($_POST['OffHold']) and $_POST['OffHold']=='on') { + if (isset($_POST['OffHold']) AND $_POST['OffHold']=='on') { $OffHold=0; } else { $OffHold=1; @@ -69,7 +72,7 @@ authlevel='".$_POST['AuthLevel']."' WHERE userid='".$_POST['UserID']."' AND currabrev='".$_POST['CurrCode']."'"; - + $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); } @@ -104,6 +107,7 @@ www_users.realname, currencies.currabrev, currencies.currency, + currencies.decimalplaces, purchorderauth.cancreate, purchorderauth.offhold, purchorderauth.authlevel @@ -125,22 +129,22 @@ while ($myrow=DB_fetch_array($Result)) { if ($myrow['cancreate']==0) { - $CanCreate=_('Yes'); + $DisplayCanCreate=_('Yes'); } else { - $CanCreate=_('No'); + $DisplayCanCreate=_('No'); } if ($myrow['offhold']==0) { - $OffHold=_('Yes'); + $DisplayOffHold=_('Yes'); } else { - $OffHold=_('No'); + $DisplayOffHold=_('No'); } echo '<tr> <td>' . $myrow['userid'] . '</td> <td>' . $myrow['realname'] . '</td> <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td>' . $DisplayCanCreate . '</td> + <td>' . $DisplayOffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],$myrow['decimalplaces']).'</td> <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . @@ -150,15 +154,23 @@ echo '</table><br><br>'; +if (!isset($_GET['Edit'])) { + $UserID=$_SESSION['UserID']; + $Currency=$_SESSION['CompanyRecord']['currencydefault']; + $CanCreate=0; + $OffHold=0; + $AuthLevel=0; +} + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form1">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; if (isset($_GET['Edit'])) { - echo '<tr><td>'._('User ID').'</td><td>'.$UserID.'</td></tr>'; - echo '<input type=hidden name=UserID value="'.$UserID.'"'; + echo '<tr><td>'._('User ID').'</td><td>'.$_GET['UserID'].'</td></tr>'; + echo '<input type="hidden" name="UserID" value="'.$_GET['UserID'].'" />'; } else { - echo '<tr><td>'._('User ID').'</td><td><select name=UserID>'; + echo '<tr><td>'._('User ID').'</td><td><select name="UserID">'; $usersql="SELECT userid FROM www_users"; $userresult=DB_query($usersql,$db); while ($myrow=DB_fetch_array($userresult)) { @@ -172,14 +184,28 @@ } if (isset($_GET['Edit'])) { - $CurrencySQL="SELECT currency FROM currencies WHERE currabrev='".$Currency."'"; - $CurrencyResult=DB_query($CurrencySQL,$db); - $myrow=DB_fetch_array($CurrencyResult); + $sql="SELECT cancreate, + offhold, + authlevel, + currency + FROM purchorderauth INNER JOIN currencies + ON purchorderauth.currabrev=currencies.currabrev + WHERE userid='".$_GET['UserID']."' + AND purchorderauth.currabrev='".$_GET['Currency']."'"; + $ErrMsg = _('The authentication details cannot be retrieved because'); + $result=DB_query($sql,$db,$ErrMsg); + $myrow=DB_fetch_array($result); + $UserID=$_GET['UserID']; + $Currency=$_GET['Currency']; + $CanCreate=$myrow['cancreate']; + $OffHold=$myrow['offhold']; + $AuthLevel=$myrow['authlevel']; + echo '<tr> <td>'._('Currency').'</td> <td>' . $myrow['currency'] . '</td> </tr>'; - echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; + echo '<input type=hidden name="CurrCode" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; $currencysql="SELECT currabrev,currency FROM currencies"; Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PO_Header.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -653,7 +653,7 @@ $PurchItemRow['leadtime'], $PurchItemRow['suppliers_partno'] ); - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?identifier='.$identifier. "'>"; + echo '<meta http-equiv="refresh" content="0; url=' . $rootpath . '/PO_Items.php?identifier='.$identifier. '">'; } /*Set up form for entry of order header stuff */ Modified: trunk/PcAssignCashToTab.php =================================================================== --- trunk/PcAssignCashToTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcAssignCashToTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -23,12 +23,31 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTabs); + unset($SelectedIndex); + unset($Days); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['Receipt']); } -$Errors = array(); +if (isset($_POST['process'])) { + if ($SelectedTabs=='') { + prnMsg(_('You Must First Select a Petty Cash Tab To Assign Cash'),'error'); + unset($SelectedTabs); + } +} +if (isset($_POST['Go'])) { + $InputError = 0; + if ($Days<=0) { + $InputError = 1; + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -43,9 +62,7 @@ if ($_POST['Amount']==0) { $InputError = 1; - prnMsg('<br />' . _('The Amount must be inputed'),'error'); - $Errors[$i] = 'TabCode'; - $i++; + prnMsg('<br />' . _('The Amount must be input'),'error'); } $sqlLimit = "SELECT tablimit @@ -56,7 +73,7 @@ $Limit=DB_fetch_array($ResultLimit); if (($_POST['CurrentAmount']+$_POST['Amount'])>$Limit['tablimit']){ - prnMsg('<br />' . _('The balance after this assignment would be greater than the specified limit for this PC tab'),'warning'); + prnMsg(_('The balance after this assignment would be greater than the specified limit for this PC tab'),'warning'); } if ($InputError !=1 AND isset($SelectedIndex) ) { @@ -92,7 +109,7 @@ '" . $_POST['Notes'] . "', '" . $_POST['Receipt'] . "' )"; - $msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST["SelectedTabs"] . ' ' . _('has been created'); + $msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); } if ( $InputError !=1) { @@ -103,6 +120,8 @@ unset($_POST['Amount']); unset($_POST['Notes']); unset($_POST['Receipt']); + unset($_POST['SelectedTabs']); + unset($_POST['Date']); } } elseif ( isset($_GET['delete']) ) { @@ -128,16 +147,16 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table echo '<tr><td>' . _('Petty Cash Tab To Assign Cash') . ':</td> <td><select name="SelectedTabs">'; DB_free_result($result); $SQL = "SELECT tabcode - FROM pctabs - WHERE authorizer='" . $_SESSION['UserID'] . "' - ORDER BY tabcode"; + FROM pctabs + WHERE authorizer='" . $_SESSION['UserID'] . "' + ORDER BY tabcode"; $result = DB_query($SQL,$db); @@ -179,7 +198,7 @@ } $sql = "SELECT * FROM pcashdetails WHERE tabcode='" . $SelectedTabs . "' - AND date >=DATE_SUB(CURDATE(), INTERVAL '".$Days."' DAY) + AND date >=DATE_SUB(CURDATE(), INTERVAL , '".$Days."' DAY) ORDER BY date, counterindex ASC"; @@ -188,7 +207,7 @@ echo '<table class=selection>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><th colspan="8">' . _('Detail Of PC Tab Movements For Last ') .': '; + echo '<tr><th colspan="8">' . _('Detail Of PC Tab Movements For Last') .': '; echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' . _('Days'); echo '<input type=submit name="Go" value="' . _('Go') . '">'; @@ -228,7 +247,7 @@ // only cash assignations NOT authorized can be modified or deleted echo '<td>' . ConvertSQLDate($myrow['date']) . '</td> <td>' . $Description['0'] . '</td> - <td class=number>' . number_format($myrow['amount'],2) . '</td> + <td class=number>' . number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['authorized']) . '</td> <td>' . $myrow['notes'] . '</td> <td>' . $myrow['receipt'] . '</td> @@ -242,7 +261,7 @@ }else{ echo '<td>' . ConvertSQLDate($myrow['date']) . '</td> <td>' . $Description['0'] . '</td> - <td class=number>' . number_format($myrow['amount'],2).'</td> + <td class=number>' . number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> <td>' . ConvertSQLDate($myrow['authorized']) . '</td> <td>' . $myrow['notes'] . '</td> <td>' . $myrow['receipt'] . '</td> @@ -263,7 +282,7 @@ } echo '<tr><td colspan="2" style="text-align:right"><b>' . _('Current balance') . ':</b></td> - <td>' . number_format($Amount['0'],2) . '</td></tr>'; + <td>' . number_format($Amount['0'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; echo '</table>'; @@ -286,7 +305,7 @@ if ( isset($_GET['edit'])) { $sql = "SELECT * FROM pcashdetails - WHERE counterindex='".$SelectedIndex."'"; + WHERE counterindex='".$SelectedIndex."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -340,13 +359,12 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"><input type=submit name=Cancel value="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"> + <input type=submit name=Cancel value="' . _('Cancel') . '"></div>'; echo '</form>'; } // end if user wish to delete - } - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PcAuthorizeExpenses.php =================================================================== --- trunk/PcAuthorizeExpenses.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcAuthorizeExpenses.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -24,11 +24,19 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Process'])) { + if ($SelectedTabs=='') { + prnMsg(_('You Must First Select a Petty Cash Tab To Authorise'),'error'); + unset($SelectedTabs); + } } -$Errors = array(); +if (isset($_POST['Go'])) { + if ($Days<=0) { + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} if (isset($SelectedTabs)) { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Petty Cash') . @@ -37,7 +45,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Petty Cash') . '" alt="" />' . _('Authorization Of Petty Cash Expenses ') . '</p>'; } -if (isset($_POST['submit']) or isset($_POST['update']) OR isset($SelectedTabs) OR isset ($_POST['GO'])) { +if (isset($_POST['Submit']) or isset($_POST['update']) OR isset($SelectedTabs) OR isset ($_POST['GO'])) { echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -82,7 +90,7 @@ <th>' . _('Posted') . '</th> <th>' . _('Notes') . '</th> <th>' . _('Receipt') . '</th> - <th>' . _('Authorized') . '</th> + <th>' . _('Authorised') . '</th> </tr>'; $k=0; //row colour counter @@ -92,7 +100,7 @@ while ($myrow=DB_fetch_array($result)) { //update database if update pressed - if ((isset($_POST['submit']) and $_POST['submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ + if ((isset($_POST['Submit']) AND $_POST['Submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ $PeriodNo = GetPeriod(ConvertSQLDate($myrow['date']), $db); @@ -225,13 +233,17 @@ echo '<tr class="OddTableRows">'; $k=1; } - + if ($myrow['posted']==0) { + $Posted=_('No'); + } else { + $Posted=_('Yes'); + } echo'<td>'.ConvertSQLDate($myrow['date']).'</td> <td>'.$myrow['codeexpense'].'</td> <td class="number">'.number_format($myrow['amount'],2).'</td> - <td>'.$myrow['posted'].'</td> - <td>'.$myrow['notes'].'</td> - <td>'.$myrow['receipt'].'</td>'; + <td>' . $Posted . '</td> + <td>' .$myrow['notes'] . '</td> + <td>' . $myrow['receipt'] . '</td>'; if (isset($_POST[$myrow['counterindex']])){ echo'<td>'.ConvertSQLDate(Date('Y-m-d')).'</td>'; @@ -263,14 +275,14 @@ $Amount['0']=0; } - echo '<tr><td colspan="4" style="text-align:right" >' . _('Current balance') . ':</td> - <td colspan="2">' . number_format($Amount['0'],2) . '</td></tr>'; + echo '<tr><td colspan=2 class="number">' . _('Current balance') . ':</td> + <td class=number>'.number_format($Amount['0'],2).'</td></tr>'; // Do the postings include ('includes/GLPostings.inc'); + echo'</table><br /><div class="centre"><input type="submit" name="Submit" value=' . _('Update') . '></div></form>'; + - echo'<tr><td style="text-align:right" colspan=4><input type="submit" name="submit" value="' . _('Update') . '"></td></tr></form>'; - } else { /*The option to submit was not hit so display form */ @@ -278,7 +290,7 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p><table class="selection">'; //Main table -echo '<tr><td>' . _('Authorize expenses to Petty Cash Tab') . ':</td> +echo '<tr><td>' . _('Authorise expenses to Petty Cash Tab') . ':</td> <td><select name="SelectedTabs">'; DB_free_result($result); @@ -292,7 +304,7 @@ if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>'; @@ -302,7 +314,8 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=process VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"> + <input type="submit" name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; } /*end of else not submit */ Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcClaimExpensesFromTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -25,12 +25,31 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTabs); + unset($SelectedIndex); + unset($Days); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['Receipt']); } -$Errors = array(); +if (isset($_POST['Process'])) { + + if ($_POST['SelectedTabs']=='') { + echo prnMsg(_('You have not selected a tab to claim the expenses on'),'error'); + unset($SelectedTabs); + } +} + +if (isset($_POST['Go'])) { + if ($Days<=0) { + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -39,13 +58,13 @@ ie the page has called itself with some user input */ //first off validate inputs sensible - $i=1; - if ($_POST['amount']==0) { + if ($_POST['SelectedExpense']=='') { + $InputError=1; + prnMsg(_('You have not selected an expense to claim on this tab'),'error'); + } elseif ($_POST['amount']==0) { $InputError = 1; prnMsg( _('The Amount must be greater than 0'),'error'); - $Errors[$i] = 'TabCode'; - $i++; } if (isset($SelectedIndex) AND $InputError !=1) { @@ -120,7 +139,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class="selection">'; //Main table + echo '<br /><table class="selection">'; //Main table echo '<tr><td>' . _('Petty Cash Tabs for User ') . $_SESSION['UserID'] . ':</td> <td><select name="SelectedTabs">'; @@ -131,7 +150,7 @@ WHERE usercode='" . $_SESSION['UserID'] . "'"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { echo '<option selected value="'; @@ -145,21 +164,24 @@ echo '</select></td></tr>'; echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type="submit" name="process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; -} +} else { // isset($SelectedTabs) -//end of ifs and buts! -if (isset($_POST['process'])OR isset($SelectedTabs)) { + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Petty Cash Claim Entry') + . '" alt="" />' . ' ' . $title . '</p>'; - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; -/* RICARD */ + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Select another tab') . '</a></div></p>'; + if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<div class="centre"><p>' . _('Detail Of Movements For Last ') .': '; + echo '<br /><table class=selection>'; + echo '<tr><th colspan="8"><font color="navy" size="3">' . _('Petty Cash Tab') . ' ' .$SelectedTabs. '</font></th></tr>'; + echo '<tr><th colspan="8">' . _('Detail Of Movements For Last ') .': '; + if(!isset ($Days)){ $Days=30; @@ -167,7 +189,7 @@ echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' ._('Days'); echo '<input type="submit" name="Go" value="' . _('Go') . '" />'; - echo '<p></div></form>'; + echo '</th></div></form>'; if (isset($_POST['Cancel'])) { unset($_POST['SelectedExpense']); @@ -184,7 +206,6 @@ $result = DB_query($sql,$db); - echo '<br><table border=1>'; echo '<tr> <th>' . _('Date Of Expense') . '</th> <th>' . _('Expense Description') . '</th> @@ -215,7 +236,11 @@ if (!isset($Description['0'])){ $Description['0']='ASSIGNCASH'; } - + if ($myrow['5']=='0000-00-00') { + $AuthorisedDate=_('Unauthorised'); + } else { + $AuthorisedDate=ConvertSQLDate($myrow['5']); + } if (($myrow['5'] == '0000-00-00') and ($Description['0'] != 'ASSIGNCASH')){ // only movements NOT authorized can be modified or deleted printf('<td>%s</td> @@ -230,7 +255,7 @@ ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), - ConvertSQLDate($myrow['5']), + $AuthorisedDate, $myrow['7'], $myrow['8'], $_SERVER['PHP_SELF'] . '?', $myrow['0'], @@ -246,7 +271,7 @@ ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), - ConvertSQLDate($myrow['5']), + $AuthorisedDate, $myrow['7'], $myrow['8']); @@ -265,11 +290,11 @@ if (!isset($Amount['0'])) { $Amount['0']=0; } + + echo '<tr><td colspan="2" style="text-align:right" >' . _('Current balance') . ':</td> + <td class="number">'.number_format($Amount['0'],2) . '</td></tr>'; - echo '<tr><td colspan="4" style="text-align:right" >' . _('Current balance') . ':</td> - <td colspan=2>'.number_format($Amount['0'],2) . '</td></tr>'; - echo '</table>'; } @@ -277,8 +302,8 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table border=1>'; //Main table - echo '<td><table>'; // First column + + echo '<br /><table class="selection">'; //Main table if ( isset($_GET['edit'])) { @@ -320,7 +345,7 @@ ORDER BY pcexpenses.codeexpense ASC"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; @@ -336,7 +361,7 @@ if (!isset($_POST['Amount'])) { $_POST['Amount']=0; } - + echo '<tr><td>' . _('Amount') . ':</td> <td><input type="text" class="number" name="amount" size="12" maxlength="11" value="' . $_POST['Amount'] . '"></td></tr>'; @@ -355,7 +380,7 @@ <td><input type="text" name="Receipt" size="50" maxlength="49" value="' . $_POST['Receipt'] . '"></td></tr>'; echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="hidden" name="Days" value="' .$Days. '">'; - echo '</table>'; // close table in first column + echo '</td></tr></table>'; // close main table echo '<p><div class="centre"><input type="submit" name="submit" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcExpenses.php =================================================================== --- trunk/PcExpenses.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcExpenses.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -15,6 +15,14 @@ $SelectedExpense = strtoupper($_GET['SelectedExpense']); } +if (isset($_POST['Cancel'])) { + unset($SelectedExpense); + unset($_POST['CodeExpense']); + unset($_POST['Description']); + unset($_POST['GLAccount']); +} + + if (isset($Errors)) { unset($Errors); } @@ -32,39 +40,55 @@ //first off validate inputs sensible $i=1; - if ($_POST['codeexpense']=='' OR $_POST['codeexpense']==' ' OR $_POST['codeexpense']==' ') { + if ($_POST['CodeExpense']=='' OR $_POST['CodeExpense']==' ' OR $_POST['CodeExpense']==' ') { $InputError = 1; prnMsg(_('The Expense type code cannot be an empty string or spaces'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - } elseif (strlen($_POST['codeexpense']) >20) { + } elseif (strlen($_POST['CodeExpense']) >20) { $InputError = 1; prnMsg(_('The Expense code must be twenty characters or less long'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - }elseif (ContainsIllegalCharacters($_POST['codeexpense'])){ + }elseif (ContainsIllegalCharacters($_POST['CodeExpense'])){ $InputError = 1; prnMsg(_('The Expense code cannot contain any of the following characters " \' - &'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - } elseif (ContainsIllegalCharacters($_POST['description'])){ + } elseif (ContainsIllegalCharacters($_POST['Description'])){ $InputError = 1; prnMsg(_('The Expense description cannot contain any of the following characters " \' - &'),'error'); - $Errors[$i] = 'TypeTabCode'; + echo '<br />'; + $Errors[$i] = 'Description'; $i++; - } elseif (strlen($_POST['description']) >50) { + } elseif (strlen($_POST['Description']) >50) { $InputError = 1; prnMsg(_('The tab code must be Fifty characters or less long'),'error'); - $Errors[$i] = 'TypeTabCode'; + echo '<br />'; + echo '<br />'; + $Errors[$i] = 'Description'; $i++; + } elseif (strlen($_POST['Description'])==0) { + $InputError = 1; + echo prnMsg(_('The tab code description must be entered'),'error'); + echo '<br />'; + $Errors[$i] = 'Description'; + $i++; + } elseif ($_POST['GLAccount']=='') { + $InputError = 1; + echo prnMsg(_('A general ledger code must be selected for this expense'),'error'); + echo '<br />'; } - + if (isset($SelectedExpense) AND $InputError !=1) { $sql = "UPDATE pcexpenses - SET description = '" . $_POST['description'] . "', - glaccount = '" . $_POST['glaccount'] . "' - WHERE codeexpense = '$SelectedExpense'"; + SET description = '" . $_POST['Description'] . "', + glaccount = '" . $_POST['GLAccount'] . "' + WHERE codeexpense = '" . $SelectedExpense . "'"; $msg = _('The Expenses type') . ' ' . $SelectedExpense . ' ' . _('has been updated'); } elseif ( $InputError !=1 ) { @@ -73,14 +97,14 @@ $checkSql = "SELECT count(*) FROM pcexpenses - WHERE codeexpense = '" . $_POST['codeexpense'] . "'"; + WHERE codeexpense = '" . $_POST['CodeExpense'] . "'"; $checkresult = DB_query($checkSql,$db); $checkrow = DB_fetch_row($checkresult); if ( $checkrow[0] > 0 ) { $InputError = 1; - prnMsg( _('The Expense type ') . $_POST['codeexpense'] . _(' already exists.'),'error'); + prnMsg( _('The Expense type ') . $_POST['CodeExpense'] . _(' already exists.'),'error'); } else { // Add new record on submit @@ -88,11 +112,11 @@ $sql = "INSERT INTO pcexpenses (codeexpense, description,glaccount) - VALUES ('" . $_POST['codeexpense'] . "', - '" . $_POST['description'] . "', - '" . $_POST['glaccount'] . "')"; + VALUES ('" . $_POST['CodeExpense'] . "', + '" . $_POST['Description'] . "', + '" . $_POST['GLAccount'] . "')"; - $msg = _('Expense ') . ' ' . $_POST['codeexpense'] . ' ' . _('has been created'); + $msg = _('Expense ') . ' ' . $_POST['CodeExpense'] . ' ' . _('has been created'); $checkSql = "SELECT count(codeexpense) FROM pcexpenses"; $result = DB_query($checkSql, $db); @@ -105,11 +129,11 @@ //run the SQL from either of the above possibilites $result = DB_query($sql,$db); prnMsg($msg,'success'); - + echo '<br />'; unset($SelectedExpense); - unset($_POST['codeexpense']); - unset($_POST['description']); - unset($_POST['glaccount']); + unset($_POST['CodeExpense']); + unset($_POST['Description']); + unset($_POST['GLAccount']); } } elseif ( isset($_GET['delete']) ) { @@ -118,7 +142,7 @@ $sql= "SELECT COUNT(*) FROM pctabexpenses - WHERE codeexpense='$SelectedExpense'"; + WHERE codeexpense='" . $SelectedExpense . "'"; $ErrMsg = _('The number of type of tabs using this expense code could not be retrieved'); $result = DB_query($sql,$db,$ErrMsg); @@ -130,14 +154,13 @@ } else { $sql="DELETE FROM pcexpenses - WHERE codeexpense='$SelectedExpense'"; + WHERE codeexpense='" . $SelectedExpense . "'"; $ErrMsg = _('The expense type record could not be deleted because'); $result = DB_query($sql,$db,$ErrMsg); prnMsg(_('Expense type') . ' ' . $SelectedExpense . ' ' . _('has been deleted') ,'success'); + echo '<br />'; unset ($SelectedExpense); unset($_GET['delete']); - - } //end if tab type used in transactions } @@ -148,17 +171,17 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT * - FROM pcexpenses'; + $sql = "SELECT * + FROM pcexpenses"; $result = DB_query($sql,$db); - echo '<table class=selection>'; + echo '<table class="selection">'; echo '<tr> <th>' . _('Code Of Expense') . '</th> <th>' . _('Description') . '</th> <th>' . _('Account Code') . '</th> <th>' . _('Account Description') . '</th> - </tr>'; + </tr>'; $k=0; //row colour counter @@ -178,19 +201,19 @@ $ResultDes = DB_query($sqldesc,$db); $Description=DB_fetch_array($ResultDes); - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> - <td><a href='%sSelectedExpense=%s'>" . _('Edit') . "</td> - <td><a href='%sSelectedExpense=%s&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedExpense=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedExpense=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', $myrow[0], $myrow[1], $myrow[2], $Description[0], $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -208,8 +231,7 @@ echo '<p><table class=selection>'; //Main table // The user wish to EDIT an existing type - if ( isset($SelectedExpense) AND $SelectedExpense!='' ) - { + if ( isset($SelectedExpense) AND $SelectedExpense!='' ){ $sql = "SELECT codeexpense, description, @@ -220,44 +242,49 @@ $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); - $_POST['codeexpense'] = $myrow['codeexpense']; - $_POST['description'] = $myrow['description']; - $_POST['glaccount'] = $myrow['glaccount']; + $_POST['CodeExpense'] = $myrow['codeexpense']; + $_POST['Description'] = $myrow['description']; + $_POST['GLAccount'] = $myrow['glaccount']; echo '<input type=hidden name="SelectedExpense" value="' . $SelectedExpense . '">'; - echo '<input type=hidden name="codeexpense" VALUE="' . $_POST['codeexpense']. '">'; - echo '<table class="selection"> <tr><td>' . _('Code Of Expense') . ':</td><td>'; - + echo '<input type=hidden name="CodeExpense" VALUE="' . $_POST['CodeExpense']. '">'; // We dont allow the user to change an existing type code + echo '<table class="selection"> + <tr> + <td>' . _('Code Of Expense') . ':</td> + <td>' . $_POST['CodeExpense'] . '</td></tr>'; - echo $_POST['codeexpense'] . '</td></tr>'; - } else { // This is a new type so the user may volunteer a type code - echo '<table class=selection> - <tr><td>' . _('Code Of Expense') . ':</td> - <td><input type="Text"' . (in_array('SalesType',$Errors) ? 'class="inputerror"' : '' ) .' name="codeexpense"></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Code Of Expense') . ':</td> + <td><input type="text"' . (in_array('CodeExpense',$Errors) ? 'class="inputerror"' : '' ) .' name="CodeExpense"></td> + </tr>'; } - if (!isset($_POST['description'])) { - $_POST['description']=''; + if (!isset($_POST['Description'])) { + $_POST['Description']=''; } - echo '<tr><td>' . _('Description') . ':</td><td><input type="Text" name="description" size=50 maxlength=49 value="' . $_POST['description'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Description') . ':</td> + <td><input type="text" ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) . ' name="Description" size=50 maxlength=49 value="' . $_POST['Description'] . '"></td> + </tr>'; - echo '<tr><td>' . _('Account Code') . ':</td><td><select name="glaccount">'; + echo '<tr><td>' . _('Account Code') . ':</td><td><select name="GLAccount">'; DB_free_result($result); - $SQL = 'SELECT accountcode, + $SQL = "SELECT accountcode, accountname FROM chartmaster - ORDER BY accountcode'; + ORDER BY accountcode"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['glaccount']) and $myrow['accountcode']==$_POST['glaccount']) { + if (isset($_POST['GLAccount']) and $myrow['accountcode']==$_POST['GLAccount']) { echo '<option selected VALUE="'; } else { echo '<option VALUE="'; @@ -270,7 +297,7 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type="submit" name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcExpensesTypeTab.php =================================================================== --- trunk/PcExpensesTypeTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcExpensesTypeTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -16,31 +16,51 @@ } else { $SelectedType=''; } -if (ContainsIllegalCharacters($SelectedType) OR strpos($SelectedType,' ')>0){ + +if (!isset($_GET['delete']) and (ContainsIllegalCharacters($SelectedType) OR strpos($SelectedType,' ')>0)){ $InputError = 1; prnMsg(_('The petty cash tab type contain any of the following characters " \' - & or a space'),'error'); } -if (isset($_POST['SelectedTabs'])){ - $SelectedTabs = strtoupper($_POST['SelectedTabs']); -} elseif (isset($_GET['SelectedTabs'])){ - $SelectedTabs = strtoupper($_GET['SelectedTabs']); + +if (isset($_POST['SelectedTab'])){ + $SelectedTab = strtoupper($_POST['SelectedTab']); +} elseif (isset($_GET['SelectedTab'])){ + $SelectedTab = strtoupper($_GET['SelectedTab']); } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTab); + unset($SelectedType); } -$Errors = array(); -$InputError=0; +if (isset($_POST['Process'])) { + + if ($_POST['SelectedTab'] == '') { + echo prnMsg(_('You have not selected a tab to maintain the expenses on'),'error'); + echo '<br />'; + unset($SelectedTab); + unset($_POST['SelectedTab']); + } +} + if (isset($_POST['submit'])) { + $InputError=0; + + if ($_POST['SelectedExpense']=='') { + $InputError=1; + echo prnMsg(_('You have not selected an expense to add to this tab'),'error'); + echo '<br />'; + unset($SelectedTab); + } + if ( $InputError !=1 ) { // First check the type is not being duplicated $checkSql = "SELECT count(*) FROM pctabexpenses - WHERE typetabcode= '" . $_POST['SelectedTabs'] . "' + WHERE typetabcode= '" . $_POST['SelectedTab'] . "' AND codeexpense = '" . $_POST['SelectedExpense'] . "'"; $checkresult = DB_query($checkSql,$db); @@ -48,23 +68,19 @@ if ( $checkrow[0] >0) { $InputError = 1; - prnMsg( _('The Expense ') . $_POST['codeexpense'] . _(' already exist in this Type of Tab.'),'error'); + prnMsg( _('The Expense') . ' ' . $_POST['codeexpense'] . ' ' ._('already exists in this Type of Tab'),'error'); } else { - // Add new record on submit + $sql = "INSERT INTO pctabexpenses (typetabcode, + codeexpense) + VALUES ('" . $_POST['SelectedTab'] . "', + '" . $_POST['SelectedExpense'] . "')"; - $sql = "INSERT INTO pctabexpenses - (typetabcode, - codeexpense) - VALUES ('" . $_POST['SelectedTabs'] . "', - '" . $_POST['SelectedExpense'] . "')"; - - $msg = _('Expense code:') . ' ' . $_POST['SelectedExpense'].' '._('for Type of Tab:') .' '. $_POST['SelectedTabs'] . ' ' . _('has been created'); + $msg = _('Expense code:') . ' ' . $_POST['SelectedExpense'].' '._('for Type of Tab:') .' '. $_POST['SelectedTab'] . ' ' . _('has been created'); $checkSql = "SELECT count(typetabcode) - FROM pctypetabs"; + FROM pctypetabs"; $result = DB_query($checkSql, $db); $row = DB_fetch_row($result); - } } @@ -77,21 +93,17 @@ } } elseif ( isset($_GET['delete']) ) { - - - $sql="DELETE FROM pctabexpenses - WHERE typetabcode='".$SelectedTabs."' - AND codeexpense='".$SelectedType."'"; - $ErrMsg = _('The Tab Type record could not be deleted because'); - $result = DB_query($sql,$db,$ErrMsg); - prnMsg(_('Expense code').' '. $SelectedType .' '. _('for type of tab').' '. $SelectedTabs .' '. _('has been deleted') ,'success'); - unset ($SelectedType); - unset($_GET['delete']); - - + $sql="DELETE FROM pctabexpenses + WHERE typetabcode='".$SelectedTab."' + AND codeexpense='".$SelectedType."'"; + $ErrMsg = _('The Tab Type record could not be deleted because'); + $result = DB_query($sql,$db,$ErrMsg); + prnMsg(_('Expense code').' '. $SelectedType .' '. _('for type of tab').' '. $SelectedTab .' '. _('has been deleted') ,'success'); + unset ($SelectedType); + unset($_GET['delete']); } -if (!isset($SelectedTabs)){ +if (!isset($SelectedTab)){ /* It could still be the second time the page has been run and a record has been selected for modification - SelectedType will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of sales types will be displayed with @@ -101,7 +113,7 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; //Main table - echo '<tr><td>' . _('Select Type of Tab') . ':</td><td><select name="SelectedTabs">'; + echo '<tr><td>' . _('Select Type of Tab') . ':</td><td><select name="SelectedTab">'; DB_free_result($result); $SQL = "SELECT typetabcode, @@ -109,12 +121,12 @@ FROM pctypetabs"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectedTabs']) and $myrow['typetabcode']==$_POST['SelectedTabs']) { + if (isset($SelectedTab) and $myrow['typetabcode']==$SelectedTab) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . ' - ' . $myrow['typetabdescription'] . '</option>'; @@ -125,26 +137,30 @@ echo '</table>'; // close table in first column echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=process VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"> + <input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; } //end of ifs and buts! -if (isset($_POST['process'])OR isset($SelectedTabs)) { +if (isset($_POST['process'])OR isset($SelectedTab)) { - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTabs. '</a></div><p>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTab. '</a></div><p>'; - $sql = "SELECT pctabexpenses.codeexpense, pcexpenses.description - FROM pctabexpenses,pcexpenses - WHERE pctabexpenses.codeexpense=pcexpenses.codeexpense - AND pctabexpenses.typetabcode='".$SelectedTabs."' + $sql = "SELECT pctabexpenses.codeexpense, + pcexpenses.description + FROM pctabexpenses INNER JOIN pcexpenses + ON pctabexpenses.codeexpense=pcexpenses.codeexpense + WHERE pctabexpenses.typetabcode='".$SelectedTab."' ORDER BY pctabexpenses.codeexpense ASC"; $result = DB_query($sql,$db); - echo '<table class="selection">'; + echo '<br /> + <table class="selection">'; + echo '<tr><th colspan="3"><font size="2" color="navy">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTab. '</font></th></tr>'; echo '<tr> <th>' . _('Expense Code') . '</th> <th>' . _('Description') . '</th> @@ -152,7 +168,7 @@ $k=0; //row colour counter -while ($myrow = DB_fetch_row($result)) { +while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -161,29 +177,24 @@ $k=1; } - printf("<td>%s</td> - <td>%s</td> - <td><a href='%sSelectedType=%s&delete=yes&SelectedTabs=$_POST[SelectedTabs]' onclick=\"return confirm('" . _('Are you sure you wish to delete this code and the expense it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", - $myrow[0], - $myrow[1], - $_SERVER['PHP_SELF'], $myrow[0], - $_SERVER['PHP_SELF'], $myrow[0]); + printf('<td>%s</td> + <td>%s</td> + <td><a href="%sSelectedType=%s&delete=yes&SelectedTab=' . $_POST['SelectedTab'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this code and the expense it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', + $myrow['codeexpense'], + $myrow['description'], + $_SERVER['PHP_SELF'], $myrow['codeexpense'], + $_SERVER['PHP_SELF'], $myrow['codeexpense']); } //END WHILE LIST LOOP echo '</table>'; - - - if (! isset($_GET['delete'])) { echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><table class="selection">'; //Main table - - echo '<tr><td>' . _('Select Expense Code') . ':</td><td><select name="SelectedExpense">'; DB_free_result($result); @@ -192,9 +203,11 @@ FROM pcexpenses"; $result = DB_query($SQL,$db); - + if (!isset($_POST['SelectedExpense'])){ + echo '<option selected value="">' . _('Not Yet Selected') . '</option>'; + } while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { + if (isset($_POST['SelectedExpense']) AND $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; } else { echo '<option value="'; @@ -206,11 +219,12 @@ echo '</select></td></tr>'; - echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; + echo '<input type="hidden" name="SelectedTab" value="' . $SelectedTab . '">'; echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"> + <input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcReportTab.php =================================================================== --- trunk/PcReportTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcReportTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -48,7 +48,7 @@ $result = DB_query($SQL,$db); while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { + if (isset($_POST['SelectedTabs']) and $myrow['tabcode']==$_POST['SelectedTabs']) { echo '<option selected value="'; } else { echo '<option value="'; @@ -117,11 +117,11 @@ $Tabs=DB_fetch_array($TabResult); $SqlBalance = "SELECT SUM(amount) FROM pcashdetails - WHERE tabcode='".$SelectedTabs."' - AND date<'".$SQL_FromDate."'"; + WHERE tabcode='".$SelectedTabs."' + AND date<'".$SQL_FromDate."'"; $TabBalance = DB_query($SqlBalance, - $db); + $db); $Balance=DB_fetch_array($TabBalance); @@ -177,17 +177,17 @@ while ($myrow=DB_fetch_array($TabDetail)) { - $sqldes="SELECT description - FROM pcexpenses - WHERE codeexpense='". $myrow[3] . "'"; + $sqldes="SELECT description + FROM pcexpenses + WHERE codeexpense='". $myrow[3] . "'"; + + $ResultDes = DB_query($sqldes,$db); + $Description=DB_fetch_array($ResultDes); + + if (!isset($Description[0])){ + $Description[0]='ASSIGNCASH'; + } - $ResultDes = DB_query($sqldes,$db); - $Description=DB_fetch_array($ResultDes); - - if (!isset($Description[0])){ - $Description[0]='ASSIGNCASH'; - } - // Print total for each account $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,70,$FontSize,ConvertSQLDate($myrow['date'])); $LeftOvers = $pdf->addTextWrap($Left_Margin+70,$YPos,130,$FontSize,$Description[0]); Modified: trunk/PcTabs.php =================================================================== --- trunk/PcTabs.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcTabs.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -14,13 +14,26 @@ $SelectedTab = strtoupper($_GET['SelectedTab']); } +if (isset($_POST['Cancel'])) { + unset($SelectedTab); + unset($_POST['TabCode'] ); + unset($_POST['SelectUser'] ); + unset($_POST['SelectTabs']); + unset($_POST['SelectCurrency']); + unset($_POST['TabLimit']); + unset($_POST['SelectAuthorizer']); + unset($_POST['GLAccountCash']); + unset($_POST['GLAccountPcashTab']); +} + + if (isset($Errors)) { unset($Errors); } $Errors = array(); -if (isset($_POST['submit'])) { +if (isset($_POST['Submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -41,18 +54,42 @@ echo prnMsg(_('The Tab code must be twenty characters or less long'),'error'); $Errors[$i] = 'TabCode'; $i++; + } elseif (($_POST['SelectUser'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a User for this tab'),'error'); + $Errors[$i] = 'UserName'; + $i++; + } elseif (($_POST['SelectTabs'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a type of tab from the list'),'error'); + $Errors[$i] = 'TabType'; + $i++; + } elseif (($_POST['SelectAuthorizer'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a User to authorise this tab'),'error'); + $Errors[$i] = 'AuthorizerName'; + $i++; + } elseif (($_POST['GLAccountCash'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a General ledger code for the cash to be assigned from'),'error'); + $Errors[$i] = 'GLCash'; + $i++; + } elseif (($_POST['GLAccountPcashTab'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a General ledger code for this petty cash tab'),'error'); + $Errors[$i] = 'GLTab'; + $i++; } if (isset($SelectedTab) AND $InputError !=1) { - $sql = "UPDATE pctabs - SET usercode = '" . $_POST['SelectUser'] . "', - typetabcode = '" . $_POST['SelectTabs'] . "', - currency = '" . $_POST['SelectCurrency'] . "', - tablimit = '" . $_POST['TabLimit'] . "', - authorizer = '" . $_POST['SelectAuthorizer'] . "', - glaccountassignment = '" . $_POST['glaccountcash'] . "', - glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "' + $sql = "UPDATE pctabs SET usercode = '" . $_POST['SelectUser'] . "', + typetabcode = '" . $_POST['SelectTabs'] . "', + currency = '" . $_POST['SelectCurrency'] . "', + tablimit = '" . $_POST['TabLimit'] . "', + authorizer = '" . $_POST['SelectAuthorizer'] . "', + glaccountassignment = '" . $_POST['GLAccountCash'] . "', + glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "' WHERE tabcode = '".$SelectedTab."'"; $msg = _('The Tabs Of Code') . ' ' . $SelectedTab . ' ' . _('has been updated'); @@ -61,8 +98,8 @@ // First check the type is not being duplicated $checkSql = "SELECT count(*) - FROM pctabs - WHERE tabcode = '" . $_POST['TabCode'] . "'"; + FROM pctabs + WHERE tabcode = '" . $_POST['TabCode'] . "'"; $CheckResult = DB_query($checkSql,$db); $CheckRow = DB_fetch_row($CheckResult); @@ -74,24 +111,23 @@ // Add new record on submit - $sql = "INSERT INTO pctabs - (tabcode, - usercode, - typetabcode, - currency, - tablimit, - authorizer, - glaccountassignment, - glaccountpcash) - VALUES ('" . $_POST['TabCode'] . "', - '" . $_POST['SelectUser'] . "', - '" . $_POST['SelectTabs'] . "', - '" . $_POST['SelectCurrency'] . "', - '" . $_POST['TabLimit'] . "', - '" . $_POST['SelectAuthorizer'] . "', - '" . $_POST['glaccountcash'] . "', - '" . $_POST['GLAccountPcashTab'] . "')"; - + $sql = "INSERT INTO pctabs (tabcode, + usercode, + typetabcode, + currency, + tablimit, + authorizer, + glaccountassignment, + glaccountpcash) + VALUES ('" . $_POST['TabCode'] . "', + '" . $_POST['SelectUser'] . "', + '" . $_POST['SelectTabs'] . "', + '" . $_POST['SelectCurrency'] . "', + '" . $_POST['TabLimit'] . "', + '" . $_POST['SelectAuthorizer'] . "', + '" . $_POST['GLAccountCash'] . "', + '" . $_POST['GLAccountPcashTab'] . "')"; + $msg = _('Tab with Code ') . ' ' . $_POST['TabCode'] . ' ' . _('has been created'); } @@ -102,15 +138,14 @@ $result = DB_query($sql,$db); prnMsg($msg,'success'); unset($SelectedTab); - unset($_POST['SelectUser'] ); + unset($_POST['SelectUser']); + unset($_POST['TabCode']); unset($_POST['SelectTabs']); unset($_POST['SelectCurrency']); unset($_POST['TabLimit']); unset($_POST['SelectAuthorizer']); - unset($_POST['glaccountcash']); + unset($_POST['GLAccountCash']); unset($_POST['GLAccountPcashTab']); - - } } elseif ( isset($_GET['delete']) ) { @@ -130,73 +165,76 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT * - FROM pctabs - ORDER BY tabcode'; + $sql = "SELECT tabcode, + usercode, + typetabdescription, + currabrev, + tablimit, + authorizer, + glaccountassignment, + glaccountpcash, + currencies.decimalplaces, + chartmaster1.accountname AS glactassigntname, + chartmaster2.accountname AS glactpcashname + FROM pctabs INNER JOIN currencies + ON pctabs.currency=currencies.currabrev + INNER JOIN pctypetabs + ON pctabs.typetabcode=pctypetabs.typetabcode + INNER JOIN chartmaster AS chartmaster1 ON + pctabs.glaccountassignment = chartmaster1.accountcode + INNER JOIN chartmaster AS chartmaster2 ON + pctabs.glaccountpcash = chartmaster2.accountcode + ORDER BY tabcode"; $result = DB_query($sql,$db); - - echo '<br><table class=selection>'; - echo '<tr> - <th>' . _('Tab Code') . '</th> - <th>' . _('User Name') . '</th> - <th>' . _('Type Of Tab') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Limit') . '</th> - <th>' . _('Authorizer') . '</th> - <th>' . _('GL Account For Cash Assignment') . '</th> - <th>' . _('GL Account Petty Cash Tab') . '</th> - </tr>'; - -$k=0; //row colour counter - -while ($myrow = DB_fetch_row($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - - $sqldes="SELECT accountname - FROM chartmaster - WHERE accountcode='". $myrow[6] . "'"; - - $ResultDes = DB_query($sqldes,$db); - $Description=DB_fetch_array($ResultDes); - - $sqlname="SELECT accountname - FROM chartmaster - WHERE accountcode='". $myrow[7] . "'"; - - $ResultName = DB_query($sqlname,$db); - $DescriptionName=DB_fetch_array($ResultName); - - - printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href="%sSelectedTab=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedTab=%s&delete=yes" onclick=\' return confirm("' . _('Are you sure you wish to delete this tab code?') . '");\'>' . _('Delete') . '</td> - </tr>', - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - number_format($myrow[4],2), - $myrow[5], - $myrow[6].' - '.$Description[0], - $myrow[7].' - '.$DescriptionName[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); - } - //END WHILE LIST LOOP - echo '</table>'; + if (DB_num_rows($result)>0){ + echo '<br><table class=selection>'; + echo '<tr> + <th>' . _('Tab Code') . '</th> + <th>' . _('User Name') . '</th> + <th>' . _('Type Of Tab') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Limit') . '</th> + <th>' . _('Authorizer') . '</th> + <th>' . _('GL Account For Cash Assignment') . '</th> + <th>' . _('GL Account Petty Cash Tab') . '</th> + </tr>'; + + $k=0; //row colour counter + + while ($myrow = DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%sSelectedTab=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedTab=%s&delete=yes" onclick=\' return confirm("' . _('Are you sure you wish to delete this tab code?') . '");\'>' . _('Delete') . '</td> + </tr>', + $myrow['tabcode'], + $myrow['usercode'], + $myrow['typetabdescription'], + $myrow['currabrev'], + number_format($myrow['tablimit'],$myrow['decimalplaces']), + $myrow['authorizer'], + $myrow['glaccountassignment'].' - '. $myrow['glactassigntname'], + $myrow['glaccountpcash'].' - '.$myrow['glactpcashname'], + $_SERVER['PHP_SELF'] . '?', $myrow['tabcode'], + $_SERVER['PHP_SELF'] . '?', $myrow['tabcode']); + } + //END WHILE LIST LOOP + echo '</table>'; + } //if there are tabs to show } //end of ifs and buts! @@ -208,7 +246,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table if ( isset($SelectedTab) AND $SelectedTab!='' ) { @@ -225,20 +263,18 @@ $_POST['SelectCurrency'] = $myrow['currency']; $_POST['TabLimit'] = $myrow['tablimit']; $_POST['SelectAuthorizer'] = $myrow['authorizer']; - $_POST['glaccountcash'] = $myrow['glaccountassignment']; + $_POST['GLAccountCash'] = $myrow['glaccountassignment']; $_POST['GLAccountPcashTab'] = $myrow['glaccountpcash']; echo '<input type=hidden name="SelectedTab" value="' . $SelectedTab . '">'; echo '<input type=hidden name="TabCode" value="' . $_POST['TabCode']. '">'; - echo '<table class="selection"> <tr><td>' . _('Tab Code') . ':</td><td>'; - - // We dont allow the user to change an existing type code - - echo $_POST['TabCode'] . '</td></tr>'; - + echo '<table class="selection"> + <tr> + <td>' . _('Tab Code') . ':</td> + <td>' . $_POST['TabCode'] . '</td> + </tr>'; } else { - // This is a new type so the user may volunteer a type code echo '<table class="selection"> <tr><td>' . _('Tab Code') . ':</td> @@ -254,7 +290,8 @@ <td><select name="SelectUser">'; DB_free_result($result); - $SQL = "SELECT userid + $SQL = "SELECT userid, + realname FROM www_users ORDER BY userid"; $result = DB_query($SQL,$db); @@ -265,7 +302,7 @@ } else { echo '<option value="'; } - echo $myrow['userid'] . '">' . $myrow['userid'] . '</option>'; + echo $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>'; } //end while loop get user @@ -275,7 +312,10 @@ <td><select name="SelectTabs">'; DB_free_result($result); - $SQL = "SELECT typetabcode FROM pctypetabs ORDER BY typetabcode"; + $SQL = "SELECT typetabcode, + typetabdescription + FROM pctypetabs + ORDER BY typetabcode"; $result = DB_query($SQL,$db); @@ -285,7 +325,7 @@ } else { echo '<option value="'; } - echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . '</option>'; + echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . ' - ' . $myrow['typetabdescription'] . '</option>'; } //end while loop get type of tab @@ -318,11 +358,12 @@ echo '<tr><td>' . _('Limit Of Tab') . ':</td> <td><input type="Text" class="number" name="TabLimit" size="12" maxlength="11" value="' . $_POST['TabLimit'] . '"></td></tr>'; - echo '<tr><td>' . _('Authorizer') . ':</td> + echo '<tr><td>' . _('Authoriser') . ':</td> <td><select name="SelectAuthorizer">'; DB_free_result($result); - $SQL = "SELECT userid + $SQL = "SELECT userid, + realname FROM www_users ORDER BY userid"; @@ -334,14 +375,14 @@ } else { echo '<option value="'; } - echo $myrow['userid'] . '">' . $myrow['userid'] . '</option>'; + echo $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>'; } //end while loop get authorizer echo '</select></td></tr>'; echo '<tr><td>' . _('GL Account Cash Assignment') . ':</td> - <td><select name="glaccountcash">'; + <... [truncated message content] |
From: <dai...@us...> - 2011-05-15 04:34:57
|
Revision: 4567 http://web-erp.svn.sourceforge.net/web-erp/?rev=4567&view=rev Author: daintree Date: 2011-05-15 04:34:49 +0000 (Sun, 15 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/FixedAssetCategories.php trunk/Logout.php trunk/PO_AuthorisationLevels.php trunk/PO_Header.php trunk/PcAssignCashToTab.php trunk/PcAuthorizeExpenses.php trunk/PcClaimExpensesFromTab.php trunk/PcExpenses.php trunk/PcExpensesTypeTab.php trunk/PcReportTab.php trunk/PcTabs.php trunk/PcTypeTabs.php trunk/UnitsOfMeasure.php trunk/doc/Change.log trunk/includes/Login.php Modified: trunk/FixedAssetCategories.php =================================================================== --- trunk/FixedAssetCategories.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/FixedAssetCategories.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -50,10 +50,9 @@ $InputError =1; } /*Make an array of the defined bank accounts */ - $SQL = 'SELECT bankaccounts.accountcode - FROM bankaccounts, - chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + $SQL = "SELECT bankaccounts.accountcode + FROM bankaccounts INNER JOIN chartmaster + ON bankaccounts.accountcode=chartmaster.accountcode"; $result = DB_query($SQL,$db); $BankAccounts = array(); $i=0; @@ -123,7 +122,7 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'fixedassets' - $sql= "SELECT COUNT(*) FROM fixedasset WHERE fixedassets.assetcategoryid='" . $SelectedCategory . "'"; + $sql= "SELECT COUNT(*) FROM fixedassets WHERE fixedassets.assetcategoryid='" . $SelectedCategory . "'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/Logout.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -23,7 +23,7 @@ <?php echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; ?> - <span><?php echo _('Thank you for using webERP'); ?></span> + <span><?php echo _('Thank you for using webERP'); ?></span> <br /> <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> </form> Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PO_AuthorisationLevels.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -8,18 +8,21 @@ include('includes/header.inc'); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/group_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; -$User=''; -$Currency=''; -$CanCreate=1; -$OffHold=1; -$AuthLevel=0; + + +/*Note: If CanCreate==0 then this means the user can create orders + * Also if OffHold==0 then the user can release purchase invocies + * This logic confused me a bit to start with + */ + + if (isset($_POST['Submit'])) { - if (isset($_POST['CanCreate']) and $_POST['CanCreate']=='on') { + if (isset($_POST['CanCreate']) AND $_POST['CanCreate']=='on') { $CanCreate=0; } else { $CanCreate=1; } - if (isset($_POST['OffHold']) and $_POST['OffHold']=='on') { + if (isset($_POST['OffHold']) AND $_POST['OffHold']=='on') { $OffHold=0; } else { $OffHold=1; @@ -48,17 +51,17 @@ $Result=DB_query($sql,$db,$ErrMsg); } else { prnMsg(_('There already exists an entry for this user/currency combination'), 'error'); - echo '<br />'; + echo '<br />'; } } if (isset($_POST['Update'])) { - if (isset($_POST['CanCreate']) and $_POST['CanCreate']=='on') { + if (isset($_POST['CanCreate']) AND $_POST['CanCreate']=='on') { $CanCreate=0; } else { $CanCreate=1; } - if (isset($_POST['OffHold']) and $_POST['OffHold']=='on') { + if (isset($_POST['OffHold']) AND $_POST['OffHold']=='on') { $OffHold=0; } else { $OffHold=1; @@ -69,7 +72,7 @@ authlevel='".$_POST['AuthLevel']."' WHERE userid='".$_POST['UserID']."' AND currabrev='".$_POST['CurrCode']."'"; - + $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); } @@ -104,6 +107,7 @@ www_users.realname, currencies.currabrev, currencies.currency, + currencies.decimalplaces, purchorderauth.cancreate, purchorderauth.offhold, purchorderauth.authlevel @@ -125,22 +129,22 @@ while ($myrow=DB_fetch_array($Result)) { if ($myrow['cancreate']==0) { - $CanCreate=_('Yes'); + $DisplayCanCreate=_('Yes'); } else { - $CanCreate=_('No'); + $DisplayCanCreate=_('No'); } if ($myrow['offhold']==0) { - $OffHold=_('Yes'); + $DisplayOffHold=_('Yes'); } else { - $OffHold=_('No'); + $DisplayOffHold=_('No'); } echo '<tr> <td>' . $myrow['userid'] . '</td> <td>' . $myrow['realname'] . '</td> <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td>' . $DisplayCanCreate . '</td> + <td>' . $DisplayOffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],$myrow['decimalplaces']).'</td> <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . @@ -150,15 +154,23 @@ echo '</table><br><br>'; +if (!isset($_GET['Edit'])) { + $UserID=$_SESSION['UserID']; + $Currency=$_SESSION['CompanyRecord']['currencydefault']; + $CanCreate=0; + $OffHold=0; + $AuthLevel=0; +} + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post" name="form1">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; if (isset($_GET['Edit'])) { - echo '<tr><td>'._('User ID').'</td><td>'.$UserID.'</td></tr>'; - echo '<input type=hidden name=UserID value="'.$UserID.'"'; + echo '<tr><td>'._('User ID').'</td><td>'.$_GET['UserID'].'</td></tr>'; + echo '<input type="hidden" name="UserID" value="'.$_GET['UserID'].'" />'; } else { - echo '<tr><td>'._('User ID').'</td><td><select name=UserID>'; + echo '<tr><td>'._('User ID').'</td><td><select name="UserID">'; $usersql="SELECT userid FROM www_users"; $userresult=DB_query($usersql,$db); while ($myrow=DB_fetch_array($userresult)) { @@ -172,14 +184,28 @@ } if (isset($_GET['Edit'])) { - $CurrencySQL="SELECT currency FROM currencies WHERE currabrev='".$Currency."'"; - $CurrencyResult=DB_query($CurrencySQL,$db); - $myrow=DB_fetch_array($CurrencyResult); + $sql="SELECT cancreate, + offhold, + authlevel, + currency + FROM purchorderauth INNER JOIN currencies + ON purchorderauth.currabrev=currencies.currabrev + WHERE userid='".$_GET['UserID']."' + AND purchorderauth.currabrev='".$_GET['Currency']."'"; + $ErrMsg = _('The authentication details cannot be retrieved because'); + $result=DB_query($sql,$db,$ErrMsg); + $myrow=DB_fetch_array($result); + $UserID=$_GET['UserID']; + $Currency=$_GET['Currency']; + $CanCreate=$myrow['cancreate']; + $OffHold=$myrow['offhold']; + $AuthLevel=$myrow['authlevel']; + echo '<tr> <td>'._('Currency').'</td> <td>' . $myrow['currency'] . '</td> </tr>'; - echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; + echo '<input type=hidden name="CurrCode" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; $currencysql="SELECT currabrev,currency FROM currencies"; Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PO_Header.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -653,7 +653,7 @@ $PurchItemRow['leadtime'], $PurchItemRow['suppliers_partno'] ); - echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?identifier='.$identifier. "'>"; + echo '<meta http-equiv="refresh" content="0; url=' . $rootpath . '/PO_Items.php?identifier='.$identifier. '">'; } /*Set up form for entry of order header stuff */ Modified: trunk/PcAssignCashToTab.php =================================================================== --- trunk/PcAssignCashToTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcAssignCashToTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -23,12 +23,31 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTabs); + unset($SelectedIndex); + unset($Days); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['Receipt']); } -$Errors = array(); +if (isset($_POST['process'])) { + if ($SelectedTabs=='') { + prnMsg(_('You Must First Select a Petty Cash Tab To Assign Cash'),'error'); + unset($SelectedTabs); + } +} +if (isset($_POST['Go'])) { + $InputError = 0; + if ($Days<=0) { + $InputError = 1; + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -43,9 +62,7 @@ if ($_POST['Amount']==0) { $InputError = 1; - prnMsg('<br />' . _('The Amount must be inputed'),'error'); - $Errors[$i] = 'TabCode'; - $i++; + prnMsg('<br />' . _('The Amount must be input'),'error'); } $sqlLimit = "SELECT tablimit @@ -56,7 +73,7 @@ $Limit=DB_fetch_array($ResultLimit); if (($_POST['CurrentAmount']+$_POST['Amount'])>$Limit['tablimit']){ - prnMsg('<br />' . _('The balance after this assignment would be greater than the specified limit for this PC tab'),'warning'); + prnMsg(_('The balance after this assignment would be greater than the specified limit for this PC tab'),'warning'); } if ($InputError !=1 AND isset($SelectedIndex) ) { @@ -92,7 +109,7 @@ '" . $_POST['Notes'] . "', '" . $_POST['Receipt'] . "' )"; - $msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST["SelectedTabs"] . ' ' . _('has been created'); + $msg = _('Assignment of cash to PC Tab ') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); } if ( $InputError !=1) { @@ -103,6 +120,8 @@ unset($_POST['Amount']); unset($_POST['Notes']); unset($_POST['Receipt']); + unset($_POST['SelectedTabs']); + unset($_POST['Date']); } } elseif ( isset($_GET['delete']) ) { @@ -128,16 +147,16 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table echo '<tr><td>' . _('Petty Cash Tab To Assign Cash') . ':</td> <td><select name="SelectedTabs">'; DB_free_result($result); $SQL = "SELECT tabcode - FROM pctabs - WHERE authorizer='" . $_SESSION['UserID'] . "' - ORDER BY tabcode"; + FROM pctabs + WHERE authorizer='" . $_SESSION['UserID'] . "' + ORDER BY tabcode"; $result = DB_query($SQL,$db); @@ -179,7 +198,7 @@ } $sql = "SELECT * FROM pcashdetails WHERE tabcode='" . $SelectedTabs . "' - AND date >=DATE_SUB(CURDATE(), INTERVAL '".$Days."' DAY) + AND date >=DATE_SUB(CURDATE(), INTERVAL , '".$Days."' DAY) ORDER BY date, counterindex ASC"; @@ -188,7 +207,7 @@ echo '<table class=selection>'; echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<tr><th colspan="8">' . _('Detail Of PC Tab Movements For Last ') .': '; + echo '<tr><th colspan="8">' . _('Detail Of PC Tab Movements For Last') .': '; echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' . _('Days'); echo '<input type=submit name="Go" value="' . _('Go') . '">'; @@ -228,7 +247,7 @@ // only cash assignations NOT authorized can be modified or deleted echo '<td>' . ConvertSQLDate($myrow['date']) . '</td> <td>' . $Description['0'] . '</td> - <td class=number>' . number_format($myrow['amount'],2) . '</td> + <td class=number>' . number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td>' . ConvertSQLDate($myrow['authorized']) . '</td> <td>' . $myrow['notes'] . '</td> <td>' . $myrow['receipt'] . '</td> @@ -242,7 +261,7 @@ }else{ echo '<td>' . ConvertSQLDate($myrow['date']) . '</td> <td>' . $Description['0'] . '</td> - <td class=number>' . number_format($myrow['amount'],2).'</td> + <td class=number>' . number_format($myrow['amount'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> <td>' . ConvertSQLDate($myrow['authorized']) . '</td> <td>' . $myrow['notes'] . '</td> <td>' . $myrow['receipt'] . '</td> @@ -263,7 +282,7 @@ } echo '<tr><td colspan="2" style="text-align:right"><b>' . _('Current balance') . ':</b></td> - <td>' . number_format($Amount['0'],2) . '</td></tr>'; + <td>' . number_format($Amount['0'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>'; echo '</table>'; @@ -286,7 +305,7 @@ if ( isset($_GET['edit'])) { $sql = "SELECT * FROM pcashdetails - WHERE counterindex='".$SelectedIndex."'"; + WHERE counterindex='".$SelectedIndex."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -340,13 +359,12 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"><input type=submit name=Cancel value="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"> + <input type=submit name=Cancel value="' . _('Cancel') . '"></div>'; echo '</form>'; } // end if user wish to delete - } - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PcAuthorizeExpenses.php =================================================================== --- trunk/PcAuthorizeExpenses.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcAuthorizeExpenses.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -24,11 +24,19 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Process'])) { + if ($SelectedTabs=='') { + prnMsg(_('You Must First Select a Petty Cash Tab To Authorise'),'error'); + unset($SelectedTabs); + } } -$Errors = array(); +if (isset($_POST['Go'])) { + if ($Days<=0) { + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} if (isset($SelectedTabs)) { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Petty Cash') . @@ -37,7 +45,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Petty Cash') . '" alt="" />' . _('Authorization Of Petty Cash Expenses ') . '</p>'; } -if (isset($_POST['submit']) or isset($_POST['update']) OR isset($SelectedTabs) OR isset ($_POST['GO'])) { +if (isset($_POST['Submit']) or isset($_POST['update']) OR isset($SelectedTabs) OR isset ($_POST['GO'])) { echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -82,7 +90,7 @@ <th>' . _('Posted') . '</th> <th>' . _('Notes') . '</th> <th>' . _('Receipt') . '</th> - <th>' . _('Authorized') . '</th> + <th>' . _('Authorised') . '</th> </tr>'; $k=0; //row colour counter @@ -92,7 +100,7 @@ while ($myrow=DB_fetch_array($result)) { //update database if update pressed - if ((isset($_POST['submit']) and $_POST['submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ + if ((isset($_POST['Submit']) AND $_POST['Submit']=='Update') AND isset($_POST[$myrow['counterindex']])){ $PeriodNo = GetPeriod(ConvertSQLDate($myrow['date']), $db); @@ -225,13 +233,17 @@ echo '<tr class="OddTableRows">'; $k=1; } - + if ($myrow['posted']==0) { + $Posted=_('No'); + } else { + $Posted=_('Yes'); + } echo'<td>'.ConvertSQLDate($myrow['date']).'</td> <td>'.$myrow['codeexpense'].'</td> <td class="number">'.number_format($myrow['amount'],2).'</td> - <td>'.$myrow['posted'].'</td> - <td>'.$myrow['notes'].'</td> - <td>'.$myrow['receipt'].'</td>'; + <td>' . $Posted . '</td> + <td>' .$myrow['notes'] . '</td> + <td>' . $myrow['receipt'] . '</td>'; if (isset($_POST[$myrow['counterindex']])){ echo'<td>'.ConvertSQLDate(Date('Y-m-d')).'</td>'; @@ -263,14 +275,14 @@ $Amount['0']=0; } - echo '<tr><td colspan="4" style="text-align:right" >' . _('Current balance') . ':</td> - <td colspan="2">' . number_format($Amount['0'],2) . '</td></tr>'; + echo '<tr><td colspan=2 class="number">' . _('Current balance') . ':</td> + <td class=number>'.number_format($Amount['0'],2).'</td></tr>'; // Do the postings include ('includes/GLPostings.inc'); + echo'</table><br /><div class="centre"><input type="submit" name="Submit" value=' . _('Update') . '></div></form>'; + - echo'<tr><td style="text-align:right" colspan=4><input type="submit" name="submit" value="' . _('Update') . '"></td></tr></form>'; - } else { /*The option to submit was not hit so display form */ @@ -278,7 +290,7 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p><table class="selection">'; //Main table -echo '<tr><td>' . _('Authorize expenses to Petty Cash Tab') . ':</td> +echo '<tr><td>' . _('Authorise expenses to Petty Cash Tab') . ':</td> <td><select name="SelectedTabs">'; DB_free_result($result); @@ -292,7 +304,7 @@ if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['tabcode'] . '">' . $myrow['tabcode'] . '</option>'; @@ -302,7 +314,8 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=process VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"> + <input type="submit" name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; } /*end of else not submit */ Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcClaimExpensesFromTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -25,12 +25,31 @@ $Days = $_GET['Days']; } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTabs); + unset($SelectedIndex); + unset($Days); + unset($_POST['Amount']); + unset($_POST['Notes']); + unset($_POST['Receipt']); } -$Errors = array(); +if (isset($_POST['Process'])) { + + if ($_POST['SelectedTabs']=='') { + echo prnMsg(_('You have not selected a tab to claim the expenses on'),'error'); + unset($SelectedTabs); + } +} + +if (isset($_POST['Go'])) { + if ($Days<=0) { + prnMsg(_('The number of days must be a positive number'),'error'); + $Days=30; + } +} + if (isset($_POST['submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -39,13 +58,13 @@ ie the page has called itself with some user input */ //first off validate inputs sensible - $i=1; - if ($_POST['amount']==0) { + if ($_POST['SelectedExpense']=='') { + $InputError=1; + prnMsg(_('You have not selected an expense to claim on this tab'),'error'); + } elseif ($_POST['amount']==0) { $InputError = 1; prnMsg( _('The Amount must be greater than 0'),'error'); - $Errors[$i] = 'TabCode'; - $i++; } if (isset($SelectedIndex) AND $InputError !=1) { @@ -120,7 +139,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class="selection">'; //Main table + echo '<br /><table class="selection">'; //Main table echo '<tr><td>' . _('Petty Cash Tabs for User ') . $_SESSION['UserID'] . ':</td> <td><select name="SelectedTabs">'; @@ -131,7 +150,7 @@ WHERE usercode='" . $_SESSION['UserID'] . "'"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { echo '<option selected value="'; @@ -145,21 +164,24 @@ echo '</select></td></tr>'; echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type="submit" name="process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; -} +} else { // isset($SelectedTabs) -//end of ifs and buts! -if (isset($_POST['process'])OR isset($SelectedTabs)) { + echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Petty Cash Claim Entry') + . '" alt="" />' . ' ' . $title . '</p>'; - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; -/* RICARD */ + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Select another tab') . '</a></div></p>'; + if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<div class="centre"><p>' . _('Detail Of Movements For Last ') .': '; + echo '<br /><table class=selection>'; + echo '<tr><th colspan="8"><font color="navy" size="3">' . _('Petty Cash Tab') . ' ' .$SelectedTabs. '</font></th></tr>'; + echo '<tr><th colspan="8">' . _('Detail Of Movements For Last ') .': '; + if(!isset ($Days)){ $Days=30; @@ -167,7 +189,7 @@ echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="text" class="number" name="Days" value="' . $Days . '" maxlength="3" size="4" /> ' ._('Days'); echo '<input type="submit" name="Go" value="' . _('Go') . '" />'; - echo '<p></div></form>'; + echo '</th></div></form>'; if (isset($_POST['Cancel'])) { unset($_POST['SelectedExpense']); @@ -184,7 +206,6 @@ $result = DB_query($sql,$db); - echo '<br><table border=1>'; echo '<tr> <th>' . _('Date Of Expense') . '</th> <th>' . _('Expense Description') . '</th> @@ -215,7 +236,11 @@ if (!isset($Description['0'])){ $Description['0']='ASSIGNCASH'; } - + if ($myrow['5']=='0000-00-00') { + $AuthorisedDate=_('Unauthorised'); + } else { + $AuthorisedDate=ConvertSQLDate($myrow['5']); + } if (($myrow['5'] == '0000-00-00') and ($Description['0'] != 'ASSIGNCASH')){ // only movements NOT authorized can be modified or deleted printf('<td>%s</td> @@ -230,7 +255,7 @@ ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), - ConvertSQLDate($myrow['5']), + $AuthorisedDate, $myrow['7'], $myrow['8'], $_SERVER['PHP_SELF'] . '?', $myrow['0'], @@ -246,7 +271,7 @@ ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), - ConvertSQLDate($myrow['5']), + $AuthorisedDate, $myrow['7'], $myrow['8']); @@ -265,11 +290,11 @@ if (!isset($Amount['0'])) { $Amount['0']=0; } + + echo '<tr><td colspan="2" style="text-align:right" >' . _('Current balance') . ':</td> + <td class="number">'.number_format($Amount['0'],2) . '</td></tr>'; - echo '<tr><td colspan="4" style="text-align:right" >' . _('Current balance') . ':</td> - <td colspan=2>'.number_format($Amount['0'],2) . '</td></tr>'; - echo '</table>'; } @@ -277,8 +302,8 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table border=1>'; //Main table - echo '<td><table>'; // First column + + echo '<br /><table class="selection">'; //Main table if ( isset($_GET['edit'])) { @@ -320,7 +345,7 @@ ORDER BY pcexpenses.codeexpense ASC"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; @@ -336,7 +361,7 @@ if (!isset($_POST['Amount'])) { $_POST['Amount']=0; } - + echo '<tr><td>' . _('Amount') . ':</td> <td><input type="text" class="number" name="amount" size="12" maxlength="11" value="' . $_POST['Amount'] . '"></td></tr>'; @@ -355,7 +380,7 @@ <td><input type="text" name="Receipt" size="50" maxlength="49" value="' . $_POST['Receipt'] . '"></td></tr>'; echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; echo '<input type="hidden" name="Days" value="' .$Days. '">'; - echo '</table>'; // close table in first column + echo '</td></tr></table>'; // close main table echo '<p><div class="centre"><input type="submit" name="submit" value="' . _('Accept') . '"><input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcExpenses.php =================================================================== --- trunk/PcExpenses.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcExpenses.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -15,6 +15,14 @@ $SelectedExpense = strtoupper($_GET['SelectedExpense']); } +if (isset($_POST['Cancel'])) { + unset($SelectedExpense); + unset($_POST['CodeExpense']); + unset($_POST['Description']); + unset($_POST['GLAccount']); +} + + if (isset($Errors)) { unset($Errors); } @@ -32,39 +40,55 @@ //first off validate inputs sensible $i=1; - if ($_POST['codeexpense']=='' OR $_POST['codeexpense']==' ' OR $_POST['codeexpense']==' ') { + if ($_POST['CodeExpense']=='' OR $_POST['CodeExpense']==' ' OR $_POST['CodeExpense']==' ') { $InputError = 1; prnMsg(_('The Expense type code cannot be an empty string or spaces'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - } elseif (strlen($_POST['codeexpense']) >20) { + } elseif (strlen($_POST['CodeExpense']) >20) { $InputError = 1; prnMsg(_('The Expense code must be twenty characters or less long'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - }elseif (ContainsIllegalCharacters($_POST['codeexpense'])){ + }elseif (ContainsIllegalCharacters($_POST['CodeExpense'])){ $InputError = 1; prnMsg(_('The Expense code cannot contain any of the following characters " \' - &'),'error'); - $Errors[$i] = 'PcExpenses'; + echo '<br />'; + $Errors[$i] = 'CodeExpense'; $i++; - } elseif (ContainsIllegalCharacters($_POST['description'])){ + } elseif (ContainsIllegalCharacters($_POST['Description'])){ $InputError = 1; prnMsg(_('The Expense description cannot contain any of the following characters " \' - &'),'error'); - $Errors[$i] = 'TypeTabCode'; + echo '<br />'; + $Errors[$i] = 'Description'; $i++; - } elseif (strlen($_POST['description']) >50) { + } elseif (strlen($_POST['Description']) >50) { $InputError = 1; prnMsg(_('The tab code must be Fifty characters or less long'),'error'); - $Errors[$i] = 'TypeTabCode'; + echo '<br />'; + echo '<br />'; + $Errors[$i] = 'Description'; $i++; + } elseif (strlen($_POST['Description'])==0) { + $InputError = 1; + echo prnMsg(_('The tab code description must be entered'),'error'); + echo '<br />'; + $Errors[$i] = 'Description'; + $i++; + } elseif ($_POST['GLAccount']=='') { + $InputError = 1; + echo prnMsg(_('A general ledger code must be selected for this expense'),'error'); + echo '<br />'; } - + if (isset($SelectedExpense) AND $InputError !=1) { $sql = "UPDATE pcexpenses - SET description = '" . $_POST['description'] . "', - glaccount = '" . $_POST['glaccount'] . "' - WHERE codeexpense = '$SelectedExpense'"; + SET description = '" . $_POST['Description'] . "', + glaccount = '" . $_POST['GLAccount'] . "' + WHERE codeexpense = '" . $SelectedExpense . "'"; $msg = _('The Expenses type') . ' ' . $SelectedExpense . ' ' . _('has been updated'); } elseif ( $InputError !=1 ) { @@ -73,14 +97,14 @@ $checkSql = "SELECT count(*) FROM pcexpenses - WHERE codeexpense = '" . $_POST['codeexpense'] . "'"; + WHERE codeexpense = '" . $_POST['CodeExpense'] . "'"; $checkresult = DB_query($checkSql,$db); $checkrow = DB_fetch_row($checkresult); if ( $checkrow[0] > 0 ) { $InputError = 1; - prnMsg( _('The Expense type ') . $_POST['codeexpense'] . _(' already exists.'),'error'); + prnMsg( _('The Expense type ') . $_POST['CodeExpense'] . _(' already exists.'),'error'); } else { // Add new record on submit @@ -88,11 +112,11 @@ $sql = "INSERT INTO pcexpenses (codeexpense, description,glaccount) - VALUES ('" . $_POST['codeexpense'] . "', - '" . $_POST['description'] . "', - '" . $_POST['glaccount'] . "')"; + VALUES ('" . $_POST['CodeExpense'] . "', + '" . $_POST['Description'] . "', + '" . $_POST['GLAccount'] . "')"; - $msg = _('Expense ') . ' ' . $_POST['codeexpense'] . ' ' . _('has been created'); + $msg = _('Expense ') . ' ' . $_POST['CodeExpense'] . ' ' . _('has been created'); $checkSql = "SELECT count(codeexpense) FROM pcexpenses"; $result = DB_query($checkSql, $db); @@ -105,11 +129,11 @@ //run the SQL from either of the above possibilites $result = DB_query($sql,$db); prnMsg($msg,'success'); - + echo '<br />'; unset($SelectedExpense); - unset($_POST['codeexpense']); - unset($_POST['description']); - unset($_POST['glaccount']); + unset($_POST['CodeExpense']); + unset($_POST['Description']); + unset($_POST['GLAccount']); } } elseif ( isset($_GET['delete']) ) { @@ -118,7 +142,7 @@ $sql= "SELECT COUNT(*) FROM pctabexpenses - WHERE codeexpense='$SelectedExpense'"; + WHERE codeexpense='" . $SelectedExpense . "'"; $ErrMsg = _('The number of type of tabs using this expense code could not be retrieved'); $result = DB_query($sql,$db,$ErrMsg); @@ -130,14 +154,13 @@ } else { $sql="DELETE FROM pcexpenses - WHERE codeexpense='$SelectedExpense'"; + WHERE codeexpense='" . $SelectedExpense . "'"; $ErrMsg = _('The expense type record could not be deleted because'); $result = DB_query($sql,$db,$ErrMsg); prnMsg(_('Expense type') . ' ' . $SelectedExpense . ' ' . _('has been deleted') ,'success'); + echo '<br />'; unset ($SelectedExpense); unset($_GET['delete']); - - } //end if tab type used in transactions } @@ -148,17 +171,17 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT * - FROM pcexpenses'; + $sql = "SELECT * + FROM pcexpenses"; $result = DB_query($sql,$db); - echo '<table class=selection>'; + echo '<table class="selection">'; echo '<tr> <th>' . _('Code Of Expense') . '</th> <th>' . _('Description') . '</th> <th>' . _('Account Code') . '</th> <th>' . _('Account Description') . '</th> - </tr>'; + </tr>'; $k=0; //row colour counter @@ -178,19 +201,19 @@ $ResultDes = DB_query($sqldesc,$db); $Description=DB_fetch_array($ResultDes); - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> - <td><a href='%sSelectedExpense=%s'>" . _('Edit') . "</td> - <td><a href='%sSelectedExpense=%s&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedExpense=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedExpense=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this expense code and all the details it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', $myrow[0], $myrow[1], $myrow[2], $Description[0], $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP echo '</table>'; @@ -208,8 +231,7 @@ echo '<p><table class=selection>'; //Main table // The user wish to EDIT an existing type - if ( isset($SelectedExpense) AND $SelectedExpense!='' ) - { + if ( isset($SelectedExpense) AND $SelectedExpense!='' ){ $sql = "SELECT codeexpense, description, @@ -220,44 +242,49 @@ $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); - $_POST['codeexpense'] = $myrow['codeexpense']; - $_POST['description'] = $myrow['description']; - $_POST['glaccount'] = $myrow['glaccount']; + $_POST['CodeExpense'] = $myrow['codeexpense']; + $_POST['Description'] = $myrow['description']; + $_POST['GLAccount'] = $myrow['glaccount']; echo '<input type=hidden name="SelectedExpense" value="' . $SelectedExpense . '">'; - echo '<input type=hidden name="codeexpense" VALUE="' . $_POST['codeexpense']. '">'; - echo '<table class="selection"> <tr><td>' . _('Code Of Expense') . ':</td><td>'; - + echo '<input type=hidden name="CodeExpense" VALUE="' . $_POST['CodeExpense']. '">'; // We dont allow the user to change an existing type code + echo '<table class="selection"> + <tr> + <td>' . _('Code Of Expense') . ':</td> + <td>' . $_POST['CodeExpense'] . '</td></tr>'; - echo $_POST['codeexpense'] . '</td></tr>'; - } else { // This is a new type so the user may volunteer a type code - echo '<table class=selection> - <tr><td>' . _('Code Of Expense') . ':</td> - <td><input type="Text"' . (in_array('SalesType',$Errors) ? 'class="inputerror"' : '' ) .' name="codeexpense"></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Code Of Expense') . ':</td> + <td><input type="text"' . (in_array('CodeExpense',$Errors) ? 'class="inputerror"' : '' ) .' name="CodeExpense"></td> + </tr>'; } - if (!isset($_POST['description'])) { - $_POST['description']=''; + if (!isset($_POST['Description'])) { + $_POST['Description']=''; } - echo '<tr><td>' . _('Description') . ':</td><td><input type="Text" name="description" size=50 maxlength=49 value="' . $_POST['description'] . '"></td></tr>'; + echo '<tr> + <td>' . _('Description') . ':</td> + <td><input type="text" ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) . ' name="Description" size=50 maxlength=49 value="' . $_POST['Description'] . '"></td> + </tr>'; - echo '<tr><td>' . _('Account Code') . ':</td><td><select name="glaccount">'; + echo '<tr><td>' . _('Account Code') . ':</td><td><select name="GLAccount">'; DB_free_result($result); - $SQL = 'SELECT accountcode, + $SQL = "SELECT accountcode, accountname FROM chartmaster - ORDER BY accountcode'; + ORDER BY accountcode"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['glaccount']) and $myrow['accountcode']==$_POST['glaccount']) { + if (isset($_POST['GLAccount']) and $myrow['accountcode']==$_POST['GLAccount']) { echo '<option selected VALUE="'; } else { echo '<option VALUE="'; @@ -270,7 +297,7 @@ echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type="submit" name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcExpensesTypeTab.php =================================================================== --- trunk/PcExpensesTypeTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcExpensesTypeTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -16,31 +16,51 @@ } else { $SelectedType=''; } -if (ContainsIllegalCharacters($SelectedType) OR strpos($SelectedType,' ')>0){ + +if (!isset($_GET['delete']) and (ContainsIllegalCharacters($SelectedType) OR strpos($SelectedType,' ')>0)){ $InputError = 1; prnMsg(_('The petty cash tab type contain any of the following characters " \' - & or a space'),'error'); } -if (isset($_POST['SelectedTabs'])){ - $SelectedTabs = strtoupper($_POST['SelectedTabs']); -} elseif (isset($_GET['SelectedTabs'])){ - $SelectedTabs = strtoupper($_GET['SelectedTabs']); + +if (isset($_POST['SelectedTab'])){ + $SelectedTab = strtoupper($_POST['SelectedTab']); +} elseif (isset($_GET['SelectedTab'])){ + $SelectedTab = strtoupper($_GET['SelectedTab']); } -if (isset($Errors)) { - unset($Errors); +if (isset($_POST['Cancel'])) { + unset($SelectedTab); + unset($SelectedType); } -$Errors = array(); -$InputError=0; +if (isset($_POST['Process'])) { + + if ($_POST['SelectedTab'] == '') { + echo prnMsg(_('You have not selected a tab to maintain the expenses on'),'error'); + echo '<br />'; + unset($SelectedTab); + unset($_POST['SelectedTab']); + } +} + if (isset($_POST['submit'])) { + $InputError=0; + + if ($_POST['SelectedExpense']=='') { + $InputError=1; + echo prnMsg(_('You have not selected an expense to add to this tab'),'error'); + echo '<br />'; + unset($SelectedTab); + } + if ( $InputError !=1 ) { // First check the type is not being duplicated $checkSql = "SELECT count(*) FROM pctabexpenses - WHERE typetabcode= '" . $_POST['SelectedTabs'] . "' + WHERE typetabcode= '" . $_POST['SelectedTab'] . "' AND codeexpense = '" . $_POST['SelectedExpense'] . "'"; $checkresult = DB_query($checkSql,$db); @@ -48,23 +68,19 @@ if ( $checkrow[0] >0) { $InputError = 1; - prnMsg( _('The Expense ') . $_POST['codeexpense'] . _(' already exist in this Type of Tab.'),'error'); + prnMsg( _('The Expense') . ' ' . $_POST['codeexpense'] . ' ' ._('already exists in this Type of Tab'),'error'); } else { - // Add new record on submit + $sql = "INSERT INTO pctabexpenses (typetabcode, + codeexpense) + VALUES ('" . $_POST['SelectedTab'] . "', + '" . $_POST['SelectedExpense'] . "')"; - $sql = "INSERT INTO pctabexpenses - (typetabcode, - codeexpense) - VALUES ('" . $_POST['SelectedTabs'] . "', - '" . $_POST['SelectedExpense'] . "')"; - - $msg = _('Expense code:') . ' ' . $_POST['SelectedExpense'].' '._('for Type of Tab:') .' '. $_POST['SelectedTabs'] . ' ' . _('has been created'); + $msg = _('Expense code:') . ' ' . $_POST['SelectedExpense'].' '._('for Type of Tab:') .' '. $_POST['SelectedTab'] . ' ' . _('has been created'); $checkSql = "SELECT count(typetabcode) - FROM pctypetabs"; + FROM pctypetabs"; $result = DB_query($checkSql, $db); $row = DB_fetch_row($result); - } } @@ -77,21 +93,17 @@ } } elseif ( isset($_GET['delete']) ) { - - - $sql="DELETE FROM pctabexpenses - WHERE typetabcode='".$SelectedTabs."' - AND codeexpense='".$SelectedType."'"; - $ErrMsg = _('The Tab Type record could not be deleted because'); - $result = DB_query($sql,$db,$ErrMsg); - prnMsg(_('Expense code').' '. $SelectedType .' '. _('for type of tab').' '. $SelectedTabs .' '. _('has been deleted') ,'success'); - unset ($SelectedType); - unset($_GET['delete']); - - + $sql="DELETE FROM pctabexpenses + WHERE typetabcode='".$SelectedTab."' + AND codeexpense='".$SelectedType."'"; + $ErrMsg = _('The Tab Type record could not be deleted because'); + $result = DB_query($sql,$db,$ErrMsg); + prnMsg(_('Expense code').' '. $SelectedType .' '. _('for type of tab').' '. $SelectedTab .' '. _('has been deleted') ,'success'); + unset ($SelectedType); + unset($_GET['delete']); } -if (!isset($SelectedTabs)){ +if (!isset($SelectedTab)){ /* It could still be the second time the page has been run and a record has been selected for modification - SelectedType will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters then none of the above are true and the list of sales types will be displayed with @@ -101,7 +113,7 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; //Main table - echo '<tr><td>' . _('Select Type of Tab') . ':</td><td><select name="SelectedTabs">'; + echo '<tr><td>' . _('Select Type of Tab') . ':</td><td><select name="SelectedTab">'; DB_free_result($result); $SQL = "SELECT typetabcode, @@ -109,12 +121,12 @@ FROM pctypetabs"; $result = DB_query($SQL,$db); - + echo '<option value="">' . _('Not Yet Selected') . '</option>'; while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectedTabs']) and $myrow['typetabcode']==$_POST['SelectedTabs']) { + if (isset($SelectedTab) and $myrow['typetabcode']==$SelectedTab) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . ' - ' . $myrow['typetabdescription'] . '</option>'; @@ -125,26 +137,30 @@ echo '</table>'; // close table in first column echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=process VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name="Process" value="' . _('Accept') . '"> + <input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; } //end of ifs and buts! -if (isset($_POST['process'])OR isset($SelectedTabs)) { +if (isset($_POST['process'])OR isset($SelectedTab)) { - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTabs. '</a></div><p>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTab. '</a></div><p>'; - $sql = "SELECT pctabexpenses.codeexpense, pcexpenses.description - FROM pctabexpenses,pcexpenses - WHERE pctabexpenses.codeexpense=pcexpenses.codeexpense - AND pctabexpenses.typetabcode='".$SelectedTabs."' + $sql = "SELECT pctabexpenses.codeexpense, + pcexpenses.description + FROM pctabexpenses INNER JOIN pcexpenses + ON pctabexpenses.codeexpense=pcexpenses.codeexpense + WHERE pctabexpenses.typetabcode='".$SelectedTab."' ORDER BY pctabexpenses.codeexpense ASC"; $result = DB_query($sql,$db); - echo '<table class="selection">'; + echo '<br /> + <table class="selection">'; + echo '<tr><th colspan="3"><font size="2" color="navy">' . _('Expense Codes for Type of Tab ') . ' ' .$SelectedTab. '</font></th></tr>'; echo '<tr> <th>' . _('Expense Code') . '</th> <th>' . _('Description') . '</th> @@ -152,7 +168,7 @@ $k=0; //row colour counter -while ($myrow = DB_fetch_row($result)) { +while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -161,29 +177,24 @@ $k=1; } - printf("<td>%s</td> - <td>%s</td> - <td><a href='%sSelectedType=%s&delete=yes&SelectedTabs=$_POST[SelectedTabs]' onclick=\"return confirm('" . _('Are you sure you wish to delete this code and the expense it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", - $myrow[0], - $myrow[1], - $_SERVER['PHP_SELF'], $myrow[0], - $_SERVER['PHP_SELF'], $myrow[0]); + printf('<td>%s</td> + <td>%s</td> + <td><a href="%sSelectedType=%s&delete=yes&SelectedTab=' . $_POST['SelectedTab'] . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this code and the expense it may have set up?') . '\');">' . _('Delete') . '</td> + </tr>', + $myrow['codeexpense'], + $myrow['description'], + $_SERVER['PHP_SELF'], $myrow['codeexpense'], + $_SERVER['PHP_SELF'], $myrow['codeexpense']); } //END WHILE LIST LOOP echo '</table>'; - - - if (! isset($_GET['delete'])) { echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /><table class="selection">'; //Main table - - echo '<tr><td>' . _('Select Expense Code') . ':</td><td><select name="SelectedExpense">'; DB_free_result($result); @@ -192,9 +203,11 @@ FROM pcexpenses"; $result = DB_query($SQL,$db); - + if (!isset($_POST['SelectedExpense'])){ + echo '<option selected value="">' . _('Not Yet Selected') . '</option>'; + } while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { + if (isset($_POST['SelectedExpense']) AND $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; } else { echo '<option value="'; @@ -206,11 +219,12 @@ echo '</select></td></tr>'; - echo '<input type="hidden" name="SelectedTabs" value="' . $SelectedTabs . '">'; + echo '<input type="hidden" name="SelectedTab" value="' . $SelectedTab . '">'; echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><input type=submit name=Cancel VALUE="' . _('Cancel') . '"></div>'; + echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"> + <input type=submit name="Cancel" value="' . _('Cancel') . '"></div>'; echo '</form>'; Modified: trunk/PcReportTab.php =================================================================== --- trunk/PcReportTab.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcReportTab.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -48,7 +48,7 @@ $result = DB_query($SQL,$db); while ($myrow = DB_fetch_array($result)) { - if (isset($_POST['SelectTabs']) and $myrow['tabcode']==$_POST['SelectTabs']) { + if (isset($_POST['SelectedTabs']) and $myrow['tabcode']==$_POST['SelectedTabs']) { echo '<option selected value="'; } else { echo '<option value="'; @@ -117,11 +117,11 @@ $Tabs=DB_fetch_array($TabResult); $SqlBalance = "SELECT SUM(amount) FROM pcashdetails - WHERE tabcode='".$SelectedTabs."' - AND date<'".$SQL_FromDate."'"; + WHERE tabcode='".$SelectedTabs."' + AND date<'".$SQL_FromDate."'"; $TabBalance = DB_query($SqlBalance, - $db); + $db); $Balance=DB_fetch_array($TabBalance); @@ -177,17 +177,17 @@ while ($myrow=DB_fetch_array($TabDetail)) { - $sqldes="SELECT description - FROM pcexpenses - WHERE codeexpense='". $myrow[3] . "'"; + $sqldes="SELECT description + FROM pcexpenses + WHERE codeexpense='". $myrow[3] . "'"; + + $ResultDes = DB_query($sqldes,$db); + $Description=DB_fetch_array($ResultDes); + + if (!isset($Description[0])){ + $Description[0]='ASSIGNCASH'; + } - $ResultDes = DB_query($sqldes,$db); - $Description=DB_fetch_array($ResultDes); - - if (!isset($Description[0])){ - $Description[0]='ASSIGNCASH'; - } - // Print total for each account $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,70,$FontSize,ConvertSQLDate($myrow['date'])); $LeftOvers = $pdf->addTextWrap($Left_Margin+70,$YPos,130,$FontSize,$Description[0]); Modified: trunk/PcTabs.php =================================================================== --- trunk/PcTabs.php 2011-05-14 11:24:22 UTC (rev 4566) +++ trunk/PcTabs.php 2011-05-15 04:34:49 UTC (rev 4567) @@ -14,13 +14,26 @@ $SelectedTab = strtoupper($_GET['SelectedTab']); } +if (isset($_POST['Cancel'])) { + unset($SelectedTab); + unset($_POST['TabCode'] ); + unset($_POST['SelectUser'] ); + unset($_POST['SelectTabs']); + unset($_POST['SelectCurrency']); + unset($_POST['TabLimit']); + unset($_POST['SelectAuthorizer']); + unset($_POST['GLAccountCash']); + unset($_POST['GLAccountPcashTab']); +} + + if (isset($Errors)) { unset($Errors); } $Errors = array(); -if (isset($_POST['submit'])) { +if (isset($_POST['Submit'])) { //initialise no input errors assumed initially before we test $InputError = 0; @@ -41,18 +54,42 @@ echo prnMsg(_('The Tab code must be twenty characters or less long'),'error'); $Errors[$i] = 'TabCode'; $i++; + } elseif (($_POST['SelectUser'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a User for this tab'),'error'); + $Errors[$i] = 'UserName'; + $i++; + } elseif (($_POST['SelectTabs'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a type of tab from the list'),'error'); + $Errors[$i] = 'TabType'; + $i++; + } elseif (($_POST['SelectAuthorizer'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a User to authorise this tab'),'error'); + $Errors[$i] = 'AuthorizerName'; + $i++; + } elseif (($_POST['GLAccountCash'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a General ledger code for the cash to be assigned from'),'error'); + $Errors[$i] = 'GLCash'; + $i++; + } elseif (($_POST['GLAccountPcashTab'])=='') { + $InputError = 1; + echo prnMsg(_('You must select a General ledger code for this petty cash tab'),'error'); + $Errors[$i] = 'GLTab'; + $i++; } if (isset($SelectedTab) AND $InputError !=1) { - $sql = "UPDATE pctabs - SET usercode = '" . $_POST['SelectUser'] . "', - typetabcode = '" . $_POST['SelectTabs'] . "', - currency = '" . $_POST['SelectCurrency'] . "', - tablimit = '" . $_POST['TabLimit'] . "', - authorizer = '" . $_POST['SelectAuthorizer'] . "', - glaccountassignment = '" . $_POST['glaccountcash'] . "', - glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "' + $sql = "UPDATE pctabs SET usercode = '" . $_POST['SelectUser'] . "', + typetabcode = '" . $_POST['SelectTabs'] . "', + currency = '" . $_POST['SelectCurrency'] . "', + tablimit = '" . $_POST['TabLimit'] . "', + authorizer = '" . $_POST['SelectAuthorizer'] . "', + glaccountassignment = '" . $_POST['GLAccountCash'] . "', + glaccountpcash = '" . $_POST['GLAccountPcashTab'] . "' WHERE tabcode = '".$SelectedTab."'"; $msg = _('The Tabs Of Code') . ' ' . $SelectedTab . ' ' . _('has been updated'); @@ -61,8 +98,8 @@ // First check the type is not being duplicated $checkSql = "SELECT count(*) - FROM pctabs - WHERE tabcode = '" . $_POST['TabCode'] . "'"; + FROM pctabs + WHERE tabcode = '" . $_POST['TabCode'] . "'"; $CheckResult = DB_query($checkSql,$db); $CheckRow = DB_fetch_row($CheckResult); @@ -74,24 +111,23 @@ // Add new record on submit - $sql = "INSERT INTO pctabs - (tabcode, - usercode, - typetabcode, - currency, - tablimit, - authorizer, - glaccountassignment, - glaccountpcash) - VALUES ('" . $_POST['TabCode'] . "', - '" . $_POST['SelectUser'] . "', - '" . $_POST['SelectTabs'] . "', - '" . $_POST['SelectCurrency'] . "', - '" . $_POST['TabLimit'] . "', - '" . $_POST['SelectAuthorizer'] . "', - '" . $_POST['glaccountcash'] . "', - '" . $_POST['GLAccountPcashTab'] . "')"; - + $sql = "INSERT INTO pctabs (tabcode, + usercode, + typetabcode, + currency, + tablimit, + authorizer, + glaccountassignment, + glaccountpcash) + VALUES ('" . $_POST['TabCode'] . "', + '" . $_POST['SelectUser'] . "', + '" . $_POST['SelectTabs'] . "', + '" . $_POST['SelectCurrency'] . "', + '" . $_POST['TabLimit'] . "', + '" . $_POST['SelectAuthorizer'] . "', + '" . $_POST['GLAccountCash'] . "', + '" . $_POST['GLAccountPcashTab'] . "')"; + $msg = _('Tab with Code ') . ' ' . $_POST['TabCode'] . ' ' . _('has been created'); } @@ -102,15 +138,14 @@ $result = DB_query($sql,$db); prnMsg($msg,'success'); unset($SelectedTab); - unset($_POST['SelectUser'] ); + unset($_POST['SelectUser']); + unset($_POST['TabCode']); unset($_POST['SelectTabs']); unset($_POST['SelectCurrency']); unset($_POST['TabLimit']); unset($_POST['SelectAuthorizer']); - unset($_POST['glaccountcash']); + unset($_POST['GLAccountCash']); unset($_POST['GLAccountPcashTab']); - - } } elseif ( isset($_GET['delete']) ) { @@ -130,73 +165,76 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT * - FROM pctabs - ORDER BY tabcode'; + $sql = "SELECT tabcode, + usercode, + typetabdescription, + currabrev, + tablimit, + authorizer, + glaccountassignment, + glaccountpcash, + currencies.decimalplaces, + chartmaster1.accountname AS glactassigntname, + chartmaster2.accountname AS glactpcashname + FROM pctabs INNER JOIN currencies + ON pctabs.currency=currencies.currabrev + INNER JOIN pctypetabs + ON pctabs.typetabcode=pctypetabs.typetabcode + INNER JOIN chartmaster AS chartmaster1 ON + pctabs.glaccountassignment = chartmaster1.accountcode + INNER JOIN chartmaster AS chartmaster2 ON + pctabs.glaccountpcash = chartmaster2.accountcode + ORDER BY tabcode"; $result = DB_query($sql,$db); - - echo '<br><table class=selection>'; - echo '<tr> - <th>' . _('Tab Code') . '</th> - <th>' . _('User Name') . '</th> - <th>' . _('Type Of Tab') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Limit') . '</th> - <th>' . _('Authorizer') . '</th> - <th>' . _('GL Account For Cash Assignment') . '</th> - <th>' . _('GL Account Petty Cash Tab') . '</th> - </tr>'; - -$k=0; //row colour counter - -while ($myrow = DB_fetch_row($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - - $sqldes="SELECT accountname - FROM chartmaster - WHERE accountcode='". $myrow[6] . "'"; - - $ResultDes = DB_query($sqldes,$db); - $Description=DB_fetch_array($ResultDes); - - $sqlname="SELECT accountname - FROM chartmaster - WHERE accountcode='". $myrow[7] . "'"; - - $ResultName = DB_query($sqlname,$db); - $DescriptionName=DB_fetch_array($ResultName); - - - printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td class=number>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href="%sSelectedTab=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedTab=%s&delete=yes" onclick=\' return confirm("' . _('Are you sure you wish to delete this tab code?') . '");\'>' . _('Delete') . '</td> - </tr>', - $myrow[0], - $myrow[1], - $myrow[2], - $myrow[3], - number_format($myrow[4],2), - $myrow[5], - $myrow[6].' - '.$Description[0], - $myrow[7].' - '.$DescriptionName[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0], - $_SERVER['PHP_SELF'] . '?', $myrow[0]); - } - //END WHILE LIST LOOP - echo '</table>'; + if (DB_num_rows($result)>0){ + echo '<br><table class=selection>'; + echo '<tr> + <th>' . _('Tab Code') . '</th> + <th>' . _('User Name') . '</th> + <th>' . _('Type Of Tab') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Limit') . '</th> + <th>' . _('Authorizer') . '</th> + <th>' . _('GL Account For Cash Assignment') . '</th> + <th>' . _('GL Account Petty Cash Tab') . '</th> + </tr>'; + + $k=0; //row colour counter + + while ($myrow = DB_fetch_array($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td class=number>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%sSelectedTab=%s">' . _('Edit') . '</td> + <td><a href="%sSelectedTab=%s&delete=yes" onclick=\' return confirm("' . _('Are you sure you wish to delete this tab code?') . '");\'>' . _('Delete') . '</td> + </tr>', + $myrow['tabcode'], + $myrow['usercode'], + $myrow['typetabdescription'], + $myrow['currabrev'], + number_format($myrow['tablimit'],$myrow['decimalplaces']), + $myrow['authorizer'], + $myrow['glaccountassignment'].' - '. $myrow['glactassigntname'], + $myrow['glaccountpcash'].' - '.$myrow['glactpcashname'], + $_SERVER['PHP_SELF'] . '?', $myrow['tabcode'], + $_SERVER['PHP_SELF'] . '?', $myrow['tabcode']); + } + //END WHILE LIST LOOP + echo '</table>'; + } //if there are tabs to show } //end of ifs and buts! @@ -208,7 +246,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table if ( isset($SelectedTab) AND $SelectedTab!='' ) { @@ -225,20 +263,18 @@ $_POST['SelectCurrency'] = $myrow['currency']; $_POST['TabLimit'] = $myrow['tablimit']; $_POST['SelectAuthorizer'] = $myrow['authorizer']; - $_POST['glaccountcash'] = $myrow['glaccountassignment']; + $_POST['GLAccountCash'] = $myrow['glaccountassignment']; $_POST['GLAccountPcashTab'] = $myrow['glaccountpcash']; echo '<input type=hidden name="SelectedTab" value="' . $SelectedTab . '">'; echo '<input type=hidden name="TabCode" value="' . $_POST['TabCode']. '">'; - echo '<table class="selection"> <tr><td>' . _('Tab Code') . ':</td><td>'; - - // We dont allow the user to change an existing type code - - echo $_POST['TabCode'] . '</td></tr>'; - + echo '<table class="selection"> + <tr> + <td>' . _('Tab Code') . ':</td> + <td>' . $_POST['TabCode'] . '</td> + </tr>'; } else { - // This is a new type so the user may volunteer a type code echo '<table class="selection"> <tr><td>' . _('Tab Code') . ':</td> @@ -254,7 +290,8 @@ <td><select name="SelectUser">'; DB_free_result($result); - $SQL = "SELECT userid + $SQL = "SELECT userid, + realname FROM www_users ORDER BY userid"; $result = DB_query($SQL,$db); @@ -265,7 +302,7 @@ } else { echo '<option value="'; } - echo $myrow['userid'] . '">' . $myrow['userid'] . '</option>'; + echo $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>'; } //end while loop get user @@ -275,7 +312,10 @@ <td><select name="SelectTabs">'; DB_free_result($result); - $SQL = "SELECT typetabcode FROM pctypetabs ORDER BY typetabcode"; + $SQL = "SELECT typetabcode, + typetabdescription + FROM pctypetabs + ORDER BY typetabcode"; $result = DB_query($SQL,$db); @@ -285,7 +325,7 @@ } else { echo '<option value="'; } - echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . '</option>'; + echo $myrow['typetabcode'] . '">' . $myrow['typetabcode'] . ' - ' . $myrow['typetabdescription'] . '</option>'; } //end while loop get type of tab @@ -318,11 +358,12 @@ echo '<tr><td>' . _('Limit Of Tab') . ':</td> <td><input type="Text" class="number" name="TabLimit" size="12" maxlength="11" value="' . $_POST['TabLimit'] . '"></td></tr>'; - echo '<tr><td>' . _('Authorizer') . ':</td> + echo '<tr><td>' . _('Authoriser') . ':</td> <td><select name="SelectAuthorizer">'; DB_free_result($result); - $SQL = "SELECT userid + $SQL = "SELECT userid, + realname FROM www_users ORDER BY userid"; @@ -334,14 +375,14 @@ } else { echo '<option value="'; } - echo $myrow['userid'] . '">' . $myrow['userid'] . '</option>'; + echo $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>'; } //end while loop get authorizer echo '</select></td></tr>'; echo '<tr><td>' . _('GL Account Cash Assignment') . ':</td> - <td><select name="glaccountcash">'; + <... [truncated message content] |
From: <dai...@us...> - 2011-05-14 11:24:31
|
Revision: 4566 http://web-erp.svn.sourceforge.net/web-erp/?rev=4566&view=rev Author: daintree Date: 2011-05-14 11:24:22 +0000 (Sat, 14 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/COGSGLPostings.php trunk/ContractBOM.php trunk/CreditStatus.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/CustomerReceipt.php trunk/DailyBankTransactions.php trunk/FTP_RadioBeacon.php trunk/FreightCosts.php trunk/POReport.php trunk/PageSecurity.php trunk/Prices.php trunk/StockQties_csv.php trunk/StockTransfers.php trunk/SupplierCredit.php trunk/TaxCategories.php trunk/doc/Change.log Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/COGSGLPostings.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -92,7 +92,7 @@ </tr>'; $k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -106,24 +106,24 @@ <td>%s</td> <td>%s</td> <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">'. _('Delete') . '</td></tr>', - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + <td><a href="%sSelectedCOGSPostingID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this COGS GL posting record?') . '\');">'. _('Delete') . '</td></tr>', + $myrow['area'], + $myrow['stkcat'], + $myrow['salestype'], + $myrow['accountname'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], + $myrow['id'], $_SERVER['PHP_SELF']. '?', - $myrow[0]); + $myrow['id']); }//end while echo '</table>'; } $sql = "SELECT cogsglpostings.id, - cogsglpostings.area, - cogsglpostings.stkcat, - cogsglpostings.salestype - FROM cogsglpostings"; + cogsglpostings.area, + cogsglpostings.stkcat, + cogsglpostings.salestype + FROM cogsglpostings"; $result = DB_query($sql,$db); @@ -147,7 +147,7 @@ $result = DB_query($sql,$db); } - $sql = "SELECT accountcode FROM chartmaster WHERE accountcode ='1' "; + $sql = "SELECT accountcode FROM chartmaster WHERE accountcode ='1'"; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ /* account number 1 is not used, so insert a new account */ @@ -195,7 +195,7 @@ <th>' . _('GL Account') . '</th> </tr>'; $k = 0; - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -211,14 +211,14 @@ <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">' . _('Delete') . '</td> </tr>', - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + $myrow['area'], + $myrow['stkcat'], + $myrow['salestype'], + $myrow['salestype'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], + $myrow['id'], $_SERVER['PHP_SELF'] . '?', - $myrow[0]); + $myrow['id']); }//END WHILE LIST LOOP echo '</table>'; @@ -305,7 +305,7 @@ echo '</select></td></tr> <tr><td>' . _('Sales Type') . ' / ' . _('Price List') . ':</td> <td><select tabindex=3 name="SalesType"> - <option VALUE="AN">' . _('Any Other') . '</option>'; + <option value="AN">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SalesType']) and $myrow['typeabbrev']==$_POST['SalesType']) { Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/ContractBOM.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -323,8 +323,7 @@ <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> </tr> <tr><td></td> - <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php?' . SID . - '">' . _('Create a New Stock Item') . '</a></font></td></tr> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></font></td></tr> </table><br /> <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /> </div><br />'; Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CreditStatus.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,8 +1,7 @@ <?php -/* $Revision: 1.16 $ */ + /* $Id$*/ -//$PageSecurity = 3; include('includes/session.inc'); $title = _('Credit Status Code Maintenance'); include('includes/header.inc'); @@ -127,7 +126,7 @@ } else { //only delete if used in neither customer or supplier accounts - $sql="DELETE FROM holdreasons WHERE reasoncode=$SelectedReason"; + $sql="DELETE FROM holdreasons WHERE reasoncode='" . $SelectedReason . "'"; $result = DB_query($sql,$db); prnMsg(_('This credit status code has been deleted'),'success'); } @@ -154,9 +153,9 @@ <th>'. _('Disallow Invoices') .'</th>'; $k=0; //row colour counter - while ($myrow=DB_fetch_row($result)) { + while ($myrow=DB_fetch_array($result)) { - if ($myrow[2]==0) { + if ($myrow['dissallowinvoices']==0) { $DissallowText = _('Invoice OK'); } else { $DissallowText = '<b>'. _('NO INVOICING') .'</b>'; @@ -169,20 +168,20 @@ $k=1; } - printf("<td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href=\"%s?SelectedReason=%s\">" . _('Edit') . "</a></td> - <td><a href=\"%s?SelectedReason=%s&delete=1\">". _('Delete') .'</a></td> - </tr>', - $myrow[0], - $myrow[1], - $DissallowText, - $_SERVER['PHP_SELF'], - $myrow[0], - $_SERVER['PHP_SELF'], - $myrow[0]); - + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%s?SelectedReason=%s">' . _('Edit') . '</a></td> + <td><a href="%s?SelectedReason=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this credit stuatus record?') . '\');">'. _('Delete') .'</a></td> + </tr>', + $myrow['reasoncode'], + $myrow['reasondescription'], + $DissallowText, + $_SERVER['PHP_SELF'], + $myrow['reasoncode'], + $_SERVER['PHP_SELF'], + $myrow['reasoncode']); + } //END WHILE LIST LOOP echo '</table>'; @@ -213,9 +212,9 @@ $_POST['ReasonDescription'] = $myrow['reasondescription']; $_POST['DisallowInvoices'] = $myrow['dissallowinvoices']; - echo "<input type=hidden name='SelectedReason' VALUE='" . $SelectedReason . "'>"; - echo "<input type=hidden name='ReasonCode' VALUE='" . $_POST['ReasonCode'] . "'>"; - echo "<table class=selection><tr><td>". _('Status Code') .':</td><td>'; + echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '">'; + echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '">'; + echo '<table class="selection"><tr><td>'. _('Status Code') .':</td><td>'; echo $_POST['ReasonCode'] . '</td></tr>'; } else { //end of if $SelectedReason only do the else when a new record is being entered @@ -224,10 +223,9 @@ } echo '<br><table class=selection> <tr> - <td>'. _('Status Code') .":</td> - <td><input " . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=1 type='Text' name='ReasonCode' VALUE='". $_POST['ReasonCode'] ."' size=3 maxlength=2></td> - </tr>"; + <td>'. _('Status Code') .':</td> + <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size=3 maxlength=2></td> + </tr>'; } if (!isset($_POST['ReasonDescription'])) { @@ -247,4 +245,4 @@ echo '</table><br><div class="centre"><input tabindex=4 type="submit" name="submit" value="' . _('Enter Information') . '"></div></form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerBranches.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -97,8 +97,8 @@ $row = DB_fetch_array($resultgeo); $api_key = $row['geocode_key']; $map_host = $row['map_host']; - define("MAPS_HOST", $map_host); - define("KEY", $api_key); + define('MAPS_HOST', $map_host); + define('KEY', $api_key); if ($map_host=="") { // check that some sane values are setup already in geocode tables, if not skip the geocoding but add the record anyway. echo '<div class="warn">' . _('Warning - Geocode Integration is enabled, but no hosts are setup. Go to Geocode Setup') . '</div>'; @@ -417,8 +417,12 @@ $DebtorNo, urlencode($myrow[1]), _('Delete Branch')); - if ($myrow[11]){ $TotalDisable++; } - else { $TotalEnable++; } + + if ($myrow[11]){ + $TotalDisable++; + }else { + $TotalEnable++; + } } while ($myrow = DB_fetch_row($result)); //END WHILE LIST LOOP @@ -628,9 +632,9 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['Salesman']) and $myrow['salesmancode']==$_POST['Salesman']) { - echo '<option selected VALUE='; + echo '<option selected value='; } else { - echo '<option VALUE='; + echo '<option value='; } echo $myrow['salesmancode'] . '>' . $myrow['salesmanname']; @@ -654,11 +658,11 @@ echo '<td><select tabindex=14 name="Area">'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['Area']) and $myrow['areacode']==$_POST['Area']) { - echo '<option selected VALUE='; + echo '<option selected value="'; } else { - echo '<option VALUE='; + echo '<option value="'; } - echo $myrow['areacode'] . '>' . $myrow['areadescription']; + echo $myrow['areacode'] . '">' . $myrow['areadescription']; } //end while loop @@ -666,7 +670,7 @@ echo '</select></td></tr>'; DB_data_seek($result,0); - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, locationname FROM locations"; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ @@ -682,11 +686,11 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['DefaultLocation']) and $myrow['loccode']==$_POST['DefaultLocation']) { - echo '<option selected value='; + echo '<option selected value="'; } else { - echo '<option value='; + echo '<option value="'; } - echo $myrow['loccode'] . '>' . $myrow['locationname'] . '</option>'; + echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } //end while loop @@ -714,11 +718,11 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['TaxGroup']) and $myrow['taxgroupid']==$_POST['TaxGroup']) { - echo '<option selected VALUE='; + echo '<option selected value="'; } else { - echo '<option VALUE='; + echo '<option value="'; } - echo $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; + echo $myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; } //end while loop @@ -779,7 +783,7 @@ if (!isset($_POST['CustBranchCode'])) {$_POST['CustBranchCode']='';} echo '<td><input tabindex=27 type="Text" name="CustBranchCode" size=31 maxlength=30 value="'. $_POST['CustBranchCode'].'"></td></tr>'; echo '</table>'; - echo '<br /><div class="centre"><input tabindex=28 type="Submit" name="submit" value="' . _('Enter Branch') . '"></div>'; + echo '<br /><div class="centre"><input tabindex=28 type="submit" name="submit" value="' . _('Enter Branch') . '"></div>'; echo '</form>'; } //end if record deleted no point displaying form to add record Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerInquiry.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,12 +1,9 @@ <?php -/* $Revision: 1.30 $ */ /* $Id$*/ include('includes/SQL_CommonFunctions.inc'); -//$PageSecurity = 1; - include('includes/session.inc'); $title = _('Customer Inquiry'); include('includes/header.inc'); @@ -15,7 +12,7 @@ if(!isset($_GET['CustomerID']) AND !isset($_SESSION['CustomerID'])){ prnMsg(_('To display the enquiry a customer must first be selected from the customer selection screen'),'info'); - echo '<br><div class="centre"><a href="'. $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Select a Customer to Inquire On') . '</a><br></div>'; + echo '<br /><div class="centre"><a href="'. $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Select a Customer to Inquire On') . '</a><br /></div>'; include('includes/footer.inc'); exit; } else { @@ -37,6 +34,7 @@ $SQL = "SELECT debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, debtorsmaster.creditlimit, holdreasons.dissallowinvoices, @@ -93,18 +91,21 @@ $NIL_BALANCE = True; - $SQL = "SELECT debtorsmaster.name, currencies.currency, paymentterms.terms, - debtorsmaster.creditlimit, holdreasons.dissallowinvoices, holdreasons.reasondescription - FROM debtorsmaster, - paymentterms, - holdreasons, - currencies - WHERE - debtorsmaster.paymentterms = paymentterms.termsindicator - AND debtorsmaster.currcode = currencies.currabrev - AND debtorsmaster.holdreason = holdreasons.reasoncode - AND debtorsmaster.debtorno = '" . $CustomerID . "'"; - + $SQL = "SELECT debtorsmaster.name, + currencies.currency, + currencies.decimalplaces, + paymentterms.terms, + debtorsmaster.creditlimit, + holdreasons.dissallowinvoices, + holdreasons.reasondescription + FROM debtorsmaster INNER JOIN paymentterms + ON debtorsmaster.paymentterms = paymentterms.termsindicator + INNER JOIN holdreasons + ON debtorsmaster.holdreason = holdreasons.reasoncode + INNER JOIN currencies + debtorsmaster.currcode = currencies.currabrev + WHERE debtorsmaster.debtorno = '" . $CustomerID . "'"; + $ErrMsg =_('The customer details could not be retrieved by the SQL because'); $CustomerResult = DB_query($SQL,$db,$ErrMsg); @@ -123,33 +124,32 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer') . ' : ' . $CustomerRecord['name'] . ' - (' . _('All amounts stated in') . - ' ' . $CustomerRecord['currency'] . ')<br><br>' . _('Terms') . ' : ' . $CustomerRecord['terms'] . '<br>' . _('Credit Limit') . + ' ' . $CustomerRecord['currency'] . ')<br /><br />' . _('Terms') . ' : ' . $CustomerRecord['terms'] . '<br />' . _('Credit Limit') . ': ' . number_format($CustomerRecord['creditlimit'],0) . ' ' . _('Credit Status') . ': ' . $CustomerRecord['reasondescription'] . '</p>'; if ($CustomerRecord['dissallowinvoices']!=0){ - echo '<br><font color=RED size=4><b>' . _('ACCOUNT ON HOLD') . '</font></b><br>'; + echo '<br /><font color=RED size=4><b>' . _('ACCOUNT ON HOLD') . '</font></b><br />'; } -echo "<table class=selection width=70%> +echo '<table class=selection width=70%> <tr> - <th width=20%>" . _('Total Balance') . "</th> - <th width=20%>" . _('Current') . "</th> - <th width=20%>" . _('Now Due') . "</th> - <th width=20%>" . $_SESSION['PastDueDays1'] . "-" . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . "</th> - <th width=20%>" . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th></tr>'; + <th width=20%>' . _('Total Balance') . '</th> + <th width=20%>' . _('Current') . '</th> + <th width=20%>' . _('Now Due') . '</th> + <th width=20%>' . $_SESSION['PastDueDays1'] . '-' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th> + <th width=20%>' . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th></tr>'; -echo '<tr><td class=number>' . number_format($CustomerRecord['balance'],2) . '</td> - <td class=number>' . number_format(($CustomerRecord['balance'] - $CustomerRecord['due']),2) . '</td> - <td class=number>' . number_format(($CustomerRecord['due']-$CustomerRecord['overdue1']),2) . '</td> - <td class=number>' . number_format(($CustomerRecord['overdue1']-$CustomerRecord['overdue2']) ,2) . '</td> - <td class=number>' . number_format($CustomerRecord['overdue2'],2) . '</td> +echo '<tr><td class=number>' . number_format($CustomerRecord['balance'],$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['balance'] - $CustomerRecord['due']),$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['due']-$CustomerRecord['overdue1']),$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['overdue1']-$CustomerRecord['overdue2']) ,$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format($CustomerRecord['overdue2'],$CustomerRecord['decimalplaces']) . '</td> </tr> </table>'; -echo "<br><div class='centre'><form action='" . $_SERVER['PHP_SELF'] . "' method=post>"; +echo '<br /><div class="centre"><form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo _('Show all transactions after') . ": <input tabindex=1 type=text class='date' alt='".$_SESSION['DefaultDateFormat']."' id='datepicker' name='TransAfterDate' Value='" . $_POST['TransAfterDate'] . "' MAXLENGTH =10 size=12>" . - " <input tabindex=2 type=submit name='Refresh Inquiry' value='" . _('Refresh Inquiry') . "'></div></form><br>"; +echo _('Show all transactions after') . ': <input tabindex=1 type=text class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" Value="' . $_POST['TransAfterDate'] . '" maxlength =10 size=12>' . '<input tabindex=2 type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '"></div></form><br />'; $DateAfterCriteria = FormatDateForSQL($_POST['TransAfterDate']); @@ -186,21 +186,22 @@ echo '<table class="selection" cellpadding="2" colspan="7">'; $tableheader = '<tr> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Comments') . '</th> - <th>' . _('Order') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('Allocated') . '</th> - <th>' . _('Balance') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th></tr>'; + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Comments') . '</th> + <th>' . _('Order') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('Allocated') . '</th> + <th>' . _('Balance') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + </tr>'; echo $tableheader; @@ -225,25 +226,26 @@ } $BaseFormatString = '<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td width="200">%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td>'; + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td width="200">%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td class=number>%s</td>'; + - $CreditInvoiceFormatString = '<td><a href="%s/Credit_Invoice.php?InvoiceNumber=%s">' . _('Credit ') .'<IMG SRC="%s/credit.gif" title="' . _('Click to credit the invoice') . '"></a></td>'; + $CreditInvoiceFormatString = '<td><a href="%s/Credit_Invoice.php?InvoiceNumber=%s">' . _('Credit ') .'<img src="%s/credit.gif" title="' . _('Click to credit the invoice') . '"></a></td>'; - $PreviewInvoiceFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('HTML ') . '<IMG SRC="%s/preview.gif" title="' . _('Click to preview the invoice') . '"></a></td> - <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '<IMG SRC="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> - <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('Email ') . '<IMG SRC="%s/email.gif" title="' . _('Click to email the invoice') . '"></a></td>'; + $PreviewInvoiceFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('HTML ') . '<img src="%s/preview.gif" title="' . _('Click to preview the invoice') . '"></a></td> + <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '<img src="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> + <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('Email ') . '<img src="%s/email.gif" title="' . _('Click to email the invoice') . '"></a></td>'; $PreviewCreditFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('HTML ') . ' <IMG SRC="%s/preview.gif" title="' . _('Click to preview the credit note') . '"></a></td> - <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True">' . _('PDF ') . '<IMG SRC="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> - <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('Email') . ' <IMG SRC="%s/email.gif" title="' . _('Click to email the credit note') . '"></a></td>'; + <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True">' . _('PDF ') . '<img src="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> + <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('Email') . ' <img src="%s/email.gif" title="' . _('Click to email the credit note') . '"></a></td>'; /* assumed allowed page security token 3 allows the user to create credits for invoices */ if (in_array(3,$_SESSION['AllowedPageSecurityTokens']) && $myrow['type']==10){ @@ -255,7 +257,7 @@ /* format string with GL inquiry options and for invoice to be credited */ printf($BaseFormatString . $CreditInvoiceFormatString . $PreviewInvoiceFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <IMG SRC="' .$rootpath. '/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <img src="' .$rootpath. '/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> </tr>', //$BaseFormatString parameters $myrow['typename'], @@ -265,9 +267,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$CreditInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -279,13 +281,12 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', //Parameter for string for GL Trans Inquiries $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //user does not have privileges to see GL inquiry stuff @@ -299,9 +300,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //CreditInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -313,8 +314,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images'); } @@ -332,9 +333,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -342,8 +343,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images'); @@ -351,8 +352,8 @@ if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . $PreviewCreditFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - <td><a href='%s/GLTransInquiry.php?%sTypeID=%s&TransNo=%s'>" . _('View GL Entries') . ' <a><IMG SRC="' .$rootpath.'/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td></tr>', + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath .'/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + <td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a><img src="' .$rootpath.'/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td></tr>', //$BaseFormatString parameters $myrow['typename'], $myrow['transno'], @@ -361,9 +362,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewCreditFormatString parameters $rootpath, $myrow['transno'], @@ -371,22 +372,21 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', // hand coded format string for Allocations and GLTrans Inquiry parameters $rootpath, $myrow['id'], $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { printf($BaseFormatString . $PreviewCreditFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='%s/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="%s/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -394,9 +394,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewCreditFormatString parameters $rootpath, $myrow['transno'], @@ -404,8 +404,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', //Parameters for hand coded string to show allocations @@ -418,9 +418,9 @@ //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - <td><a href='%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s'>" . _('View GL Entries') . " <IMG SRC='" .$rootpath."/css/".$theme."/images/gl.png' title='" . _('View the GL Entries') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath . '/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + <td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <img src="' .$rootpath . '/css/' . $theme .'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -428,19 +428,18 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, $myrow['id'], $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //no permission for GLTrans Inquiries printf($BaseFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath . '/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -448,9 +447,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, $myrow['id']); } @@ -459,7 +458,7 @@ //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -467,11 +466,10 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //no permission for GLTrans Inquiries @@ -483,15 +481,15 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2)); + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces'])); } } else { //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -499,11 +497,10 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { @@ -515,9 +512,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2)); + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces'])); } } @@ -526,4 +523,4 @@ echo '</table>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerReceipt.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -700,7 +700,7 @@ /*set up the form whatever */ -echo '<form action=' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . ' method=post name=form1>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . '" method=post name=form1>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*show the batch header details and the entries in the batch so far */ Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/DailyBankTransactions.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,6 +1,7 @@ <?php -//$PageSecurity = 8; now from Database Scripts table +/* $Id: DailyBankTransactions.php 4556 2011-04-26 11:03:36Z daintree $ */ + include ('includes/session.inc'); $title = _('Bank Transactions Inquiry'); include('includes/header.inc'); @@ -9,23 +10,24 @@ _('Search') . '" alt="" />' . ' ' . $title.'</p>'; if (!isset($_POST['Show'])) { - echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; - $SQL = 'SELECT bankaccountname, - bankaccounts.accountcode, - bankaccounts.currcode - FROM bankaccounts, - chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + $SQL = "SELECT bankaccountname, + bankaccounts.accountcode, + bankaccounts.currcode + FROM bankaccounts, + chartmaster + WHERE bankaccounts.accountcode=chartmaster.accountcode"; $ErrMsg = _('The bank accounts could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); - echo '<tr><td>' . _('Bank Account') . ':</td><td><select name="BankAccount">'; + echo '<tr><td>' . _('Bank Account') . ':</td> + <td><select name="BankAccount">'; if (DB_num_rows($AccountsResults)==0){ echo '</select></td></tr></table><p>'; @@ -60,30 +62,33 @@ echo '</form>'; } else { $SQL = "SELECT bankaccountname, - bankaccounts.currcode - FROM bankaccounts - WHERE bankaccounts.accountcode='" . $_POST['BankAccount'] . "'"; + bankaccounts.currcode, + currencies.decimalplaces + FROM bankaccounts + INNER JOIN currencies + ON bankaccounts.currcode = currencies.currabrev + WHERE bankaccounts.accountcode='" . $_POST['BankAccount'] . "'"; $BankResult = DB_query($SQL,$db,_('Could not retrieve the bank account details')); $sql="SELECT banktrans.currcode, - banktrans.amount, - banktrans.functionalexrate, - banktrans.exrate, - banktrans.banktranstype, - banktrans.transdate, - bankaccounts.bankaccountname, - systypes.typename, - systypes.typeid - FROM banktrans - INNER JOIN bankaccounts - ON banktrans.bankact=bankaccounts.accountcode - INNER JOIN systypes - ON banktrans.type=systypes.typeid - WHERE bankact='".$_POST['BankAccount']."' - AND transdate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' - AND transdate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' - ORDER BY banktrans.transdate"; + banktrans.amount, + banktrans.functionalexrate, + banktrans.exrate, + banktrans.banktranstype, + banktrans.transdate, + bankaccounts.bankaccountname, + systypes.typename, + systypes.typeid + FROM banktrans + INNER JOIN bankaccounts + ON banktrans.bankact=bankaccounts.accountcode + INNER JOIN systypes + ON banktrans.type=systypes.typeid + WHERE bankact='".$_POST['BankAccount']."' + AND transdate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' + AND transdate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' + ORDER BY banktrans.transdate"; $result = DB_query($sql, $db); if (DB_num_rows($result)==0) { prnMsg(_('There are no transactions for this account in the date range selected'), 'info'); @@ -94,15 +99,15 @@ <th colspan=7><font size=3 color=blue>' . _('Account Transactions For').' '.$BankDetailRow['bankaccountname'].' '._('Between').' '.$_POST['FromTransDate'] . ' ' . _('and') . ' ' . $_POST['ToTransDate'] . '</font></th> </tr>'; echo '<tr> - <th>' . ('Date') . '</th> - <th>'._('Transaction type').'</th> - <th>'._('Type').'</th> - <th>'._('Reference').'</th> - <th>'._('Amount in').' '.$BankDetailRow['currcode'].'</th> - <th>'._('Running Total').' '.$BankDetailRow['currcode'].'</th> - <th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> - <th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> - </tr>'; + <th>' . ('Date') . '</th> + <th>'._('Transaction type').'</th> + <th>'._('Type').'</th> + <th>'._('Reference').'</th> + <th>'._('Amount in').' '.$BankDetailRow['currcode'].'</th> + <th>'._('Running Total').' '.$BankDetailRow['currcode'].'</th> + <th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> + <th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> + </tr>'; $AccountCurrTotal=0; $LocalCurrTotal =0; @@ -113,20 +118,20 @@ $LocalCurrTotal += $myrow['amount']/$myrow['functionalexrate']/$myrow['exrate']; echo '<tr> - <td>'. ConvertSQLDate($myrow['transdate']) . '</td> - <td>'.$myrow['typename'].'</td> - <td>'.$myrow['banktranstype'].'</td> - <td>'.$myrow['ref'].'</td> - <td class=number>'.number_format($myrow['amount'],2).'</td> - <td class=number>'.number_format($AccountCurrTotal,2).'</td> - <td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],2).'</td> - <td class=number>'.number_format($LocalCurrTotal,2).'</td> - </tr>'; + <td>'. ConvertSQLDate($myrow['transdate']) . '</td> + <td>'.$myrow['typename'].'</td> + <td>'.$myrow['banktranstype'].'</td> + <td>'.$myrow['ref'].'</td> + <td class=number>'.number_format($myrow['amount'],$BankDetailRow['decimalplaces']).'</td> + <td class=number>'.number_format($AccountCurrTotal,$BankDetailRow['decimalplaces']).'</td> + <td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> + <td class=number>'.number_format($LocalCurrTotal,$_SESSION['CompanyRecord']['decimalplaces']).'</td> + </tr>'; } echo '</table>'; } //end if no bank trans in the range to show - echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br><div class="centre"><input type="submit" name="Return" value="' . _('Select Another Date'). '"></div>'; echo '</form>'; Modified: trunk/FTP_RadioBeacon.php =================================================================== --- trunk/FTP_RadioBeacon.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/FTP_RadioBeacon.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,10 +1,9 @@ <?php -/* $Revision: 1.10 $ */ + /* $Id$*/ /*Variables required to configure this script must be set in config.php */ -//$PageSecurity = 2; include('includes/session.inc'); $title=_('FTP order to Radio Beacon'); include('includes/header.inc'); @@ -47,17 +46,17 @@ echo '<table cellpadding=2 colspan=7 WIDTH=100%>'; $TableHeader = '<tr> - <td class=tableheader>' . _('Modify') . '</td> - <td class=tableheader>' . _('Send to') . '<br>' . _('Radio Beacon') . '</td> - <td class=tableheader>' . _('Customer') . '</td> - <td class=tableheader>' . _('Branch') . '</td> - <td class=tableheader>' . _('Cust Order') . ' #</td> - <td class=tableheader>' . _('Order Date') . '</td> - <td class=tableheader>' . _('Req Del Date') . '</td> - <td class=tableheader>' . _('Delivery To') . '</td> - <td class=tableheader>' . _('Order Total') . '</td> - <td class=tableheader>' . _('Last Send') . '</td> - </tr>'; + <td class=tableheader>' . _('Modify') . '</td> + <td class=tableheader>' . _('Send to') . '<br />' . _('Radio Beacon') . '</td> + <td class=tableheader>' . _('Customer') . '</td> + <td class=tableheader>' . _('Branch') . '</td> + <td class=tableheader>' . _('Cust Order') . ' #</td> + <td class=tableheader>' . _('Order Date') . '</td> + <td class=tableheader>' . _('Req Del Date') . '</td> + <td class=tableheader>' . _('Delivery To') . '</td> + <td class=tableheader>' . _('Order Total') . '</td> + <td class=tableheader>' . _('Last Send') . '</td> + </tr>'; echo $TableHeader; @@ -72,7 +71,7 @@ $k=1; } - $FTPDispatchNote = $_SERVER['PHP_SELF'] . '?' . SID . '&OrderNo=' . $myrow['orderno']; + $FTPDispatchNote = $_SERVER['PHP_SELF'] . '?OrderNo=' . $myrow['orderno']; $FormatedDelDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedOrderValue = number_format($myrow['ordervalue'],2); @@ -80,48 +79,48 @@ $ModifyPage = $rootpath . 'SelectOrderItems.php?' . SID . '&ModifyOrderNumber=' . $myrow['orderno']; if ($myrow['printedpackingslip'] ==1){ - printf("<td><font size=2><a href='%s'>%s</a></font></td> - <td><font color=RED size=2>" . _('Already') . '<br>' . _('Sent') . "</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td class=number><font size=2>%s</font></td> - <td><font size=2>%s</font></td></tr>", - $ModifyPage, - $myrow['orderno'], - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedOrderDate, - $FormatedDelDate, - $myrow['deliverto'], - $FormatedOrderValue, - $FormatedDateLastSent); + printf('<td><font size=2><a href="%s">%s</a></font></td> + <td><font color=RED size=2>' . _('Already') . '<br />' . _('Sent') . '</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td class=number><font size=2>%s</font></td> + <td><font size=2>%s</font></td></tr>', + $ModifyPage, + $myrow['orderno'], + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedOrderDate, + $FormatedDelDate, + $myrow['deliverto'], + $FormatedOrderValue, + $FormatedDateLastSent); } else { - printf("<td><font size=2><a href='%s'>%s</a></font></td> - <td><font size=2><a href='%s'>" . _('Send') . "</a></font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td class=number><font size=2>%s</font></td> - <td><font size=2>%s</font></td></tr>", - $ModifyPage, - $myrow['orderno'], - $FTPDispatchNote, - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedOrderDate, - $FormatedDelDate, - $myrow['deliverto'], - $FormatedOrderValue, - $FormatedDateLastSent); + printf('<td><font size=2><a href="%s">%s</a></font></td> + <td><font size=2><a href="%s">' . _('Send') . '</a></font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td class=number><font size=2>%s</font></td> + <td><font size=2>%s</font></td></tr>', + $ModifyPage, + $myrow['orderno'], + $FTPDispatchNote, + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedOrderDate, + $FormatedDelDate, + $myrow['deliverto'], + $FormatedOrderValue, + $FormatedDateLastSent); } $j++; if ($j == 12){ @@ -173,7 +172,7 @@ debtorsmaster WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' - AND salesorders.orderno=" . $_GET['OrderNo']; + AND salesorders.orderno='" . $_GET['OrderNo'] . "'"; $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('from the database'); @@ -183,24 +182,24 @@ $myrow = DB_fetch_array($result); if ($myrow['printedpackingslip']==1){ - prnMsg(_('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has previously been sent to Radio Beacon') . '. ' . _('It was sent on') . ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) . '<br>' . _('To re-send the order with the balance not previously dispatched and invoiced the order must be modified to allow a reprint (or re-send)') . '.<br>' . _('This check is there to ensure that duplication of dispatches to the customer are avoided'),'warn'); - echo "<p><a href='$rootpath/SelectOrderItems.php?" . SID . "&ModifyOrderNumber=" . $_GET['OrderNo'] . "'>" . _('Modify the order to allow a re-send or reprint') . ' (' . _('Select Delivery Details') . ')' . '</a>'; - echo "<p><a href='$rootpath/index.php'>" . _('Back to the menu') . '</a>'; + prnMsg(_('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has previously been sent to Radio Beacon') . '. ' . _('It was sent on') . ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) . '<br />' . _('To re-send the order with the balance not previously dispatched and invoiced the order must be modified to allow a reprint (or re-send)') . '.<br />' . _('This check is there to ensure that duplication of dispatches to the customer are avoided'),'warn'); + echo '<p><a href="' . $rootpath . '/SelectOrderItems.php?ModifyOrderNumber=' . $_GET['OrderNo'] . '">' . _('Modify the order to allow a re-send or reprint') . ' (' . _('Select Delivery Details') . ')' . '</a>'; + echo '<p><a href="' . $rootpath/index.php . '">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } /*Now get the line items */ $sql = "SELECT stkcode, - description, - quantity, - units, - qtyinvoiced, - unitprice - FROM salesorderdetails, - stockmaster - WHERE salesorderdetails.stkcode=stockmaster.stockid - AND salesorderdetails.orderno=" . $_GET['OrderNo']; + description, + quantity, + units, + qtyinvoiced, + unitprice + FROM salesorderdetails, + stockmaster + WHERE salesorderdetails.stkcode=stockmaster.stockid + AND salesorderdetails.orderno=" . $_GET['OrderNo']; $ErrMsg = _('There was a problem retrieving the line details for order number') . ' ' . $_GET['OrderNo'] . ' ' . _('from the database because'); $result=DB_query($sql,$db, $ErrMsg); @@ -267,18 +266,18 @@ $conn_id = ftp_connect($_SESSION['RadioBeaconFTP_server']); // login with username and password $login_result = ftp_login($conn_id, $_SESSION['RadioBeaconFTP_user_name'], $_SESSION['RadioBeaconFTP_user_pass']); // check connection if ((!$conn_id) || (!$login_result)) { - echo '<br>' . _('Ftp connection has failed'); - echo '<br>' . _('Attempted to connect to') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('for user') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; + echo '<br />' . _('Ftp connection has failed'); + echo '<br />' . _('Attempted to connect to') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('for user') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; die; } else { - echo '<br>' . _('Connected to Radio Beacon FTP server at') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('with user name') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; + echo '<br />' . _('Connected to Radio Beacon FTP server at') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('with user name') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; } // upload the file $upload = ftp_put($conn_id, $FilePrefix . $FileNumber . '.txt', $FileName, FTP_ASCII); // check upload status if (!$upload) { prnMsg(_('FTP upload has failed'),'success'); exit; } else { - echo '<br>' . _('Uploaded') . ' ' . $FileName . ' ' . _('to') . ' ' . $_SESSION['RadioBeaconFTP_server']; + echo '<br />' . _('Uploaded') . ' ' . $FileName . ' ' . _('to') . ' ' . $_SESSION['RadioBeaconFTP_server']; } // close the FTP stream ftp_quit($conn_id); @@ -286,7 +285,7 @@ $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno=" . $_GET['OrderNo']; $result = DB_query($sql,$db); - echo '<p>' . _('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has been sent via FTP to Radio Beacon a copy of the file that was sent is held on the server at') . '<br>' . $FileName; + echo '<p>' . _('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has been sent via FTP to Radio Beacon a copy of the file that was sent is held on the server at') . '<br />' . $FileName; } else { /*perhaps several order headers returned or none (more likely) */ Modified: trunk/FreightCosts.php =================================================================== --- trunk/FreightCosts.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/FreightCosts.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,17 +1,11 @@ <?php /* $Id$*/ -/* $Revision: 1.14 $ */ -//$PageSecurity = 11; include('includes/session.inc'); $title = _('Freight Costs Set Up'); include('includes/header.inc'); -?> - -<?php - if (isset($_GET['LocationFrom'])){ $LocationFrom = $_GET['LocationFrom']; } elseif (isset($_POST['LocationFrom'])){ @@ -33,32 +27,37 @@ if (!isset($LocationFrom) OR !isset($ShipperID)) { - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - $sql = 'SELECT shippername, shipper_id FROM shippers'; + $sql = "SELECT shippername, shipper_id FROM shippers"; $ShipperResults = DB_query($sql,$db); echo '<table class=selection> <tr> - <td>' . _('Select A Freight Company to set up costs for') . "</td> - <td><select name='ShipperID'>"; + <td>' . _('Select A Freight Company to set up costs for') . '</td> + <td><select name="ShipperID">'; while ($myrow = DB_fetch_array($ShipperResults)){ - echo '<option VALUE=' . $myrow['shipper_id'] . '>' . $myrow['shippername']; + echo '<option value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; } echo '</select></td></tr> <tr> - <td>' . _('Select the warehouse') . ' (' . _('ship from location') . ")</td> - <td><select name='LocationFrom'>"; + <td>' . _('Select the warehouse') . ' (' . _('ship from location') . ')</td> + <td><select name="LocationFrom">'; - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, + locationname + FROM locations"; $LocationResults = DB_query($sql,$db); while ($myrow = DB_fetch_array($LocationResults)){ - echo '<option VALUE=' . $myrow['loccode'] . '>' . $myrow['locationname']; + echo '<option value=' . $myrow['loccode'] . '>' . $myrow['locationname']; } - echo "</select></td></tr></table><br><div class='centre'><input type=submit value='" . _('Accept') . "' name='Accept'></div></form>"; + echo '</select></td></tr> + </table> + <br><div class="centre"><input type="submit" value="' . _('Accept') . '" name="Accept"></div> + </form>'; } else { @@ -115,8 +114,7 @@ if (isset($SelectedFreightCost) AND $InputError !=1) { $sql = "UPDATE freightcosts - SET - locationfrom='".$LocationFrom."', + SET locationfrom='".$LocationFrom."', destination='" . $_POST['Destination'] . "', shipperid='" . $ShipperID . "', cubrate='" . $_POST['CubRate'] . "', @@ -133,28 +131,27 @@ /*Selected freight cost is null cos no item selected on first time round so must be adding a record must be submitting new entries */ - $sql = "INSERT INTO freightcosts ( - locationfrom, - destination, - shipperid, - cubrate, - kgrate, - maxkgs, - maxcub, - fixedprice, - minimumchg) - VALUES ( - '".$LocationFrom."', - '" . $_POST['Destination'] . "', - '" . $ShipperID . "', - '" . $_POST['CubRate'] . "', - '" . $_POST['KGRate'] . "', - '" . $_POST['MAXKGs'] . "', - '" . $_POST['MAXCub'] . "', - '" . $_POST['FixedPrice'] ."', - '" . $_POST['MinimumChg'] . "' - )"; - + $sql = "INSERT INTO freightcosts (locationfrom, + destination, + shipperid, + cubrate, + kgrate, + maxkgs, + maxcub, + fixedprice, + minimumchg) + VALUES ( + '".$LocationFrom."', + '" . $_POST['Destination'] . "', + '" . $ShipperID . "', + '" . $_POST['CubRate'] . "', + '" . $_POST['KGRate'] . "', + '" . $_POST['MAXKGs'] . "', + '" . $_POST['MAXCub'] . "', + '" . $_POST['FixedPrice'] ."', + '" . $_POST['MinimumChg'] . "' + )"; + $msg = _('Freight cost record inserted'); } @@ -187,30 +184,30 @@ $sql = "SELECT shipcostfromid, - destination, - cubrate, - kgrate, - maxkgs, - maxcub, - fixedprice, - minimumchg - FROM freightcosts - WHERE freightcosts.locationfrom = '".$LocationFrom. "' - AND freightcosts.shipperid = '" . $ShipperID . "' - ORDER BY destination"; - + destination, + cubrate, + kgrate, + maxkgs, + maxcub, + fixedprice, + minimumchg + FROM freightcosts + WHERE freightcosts.locationfrom = '".$LocationFrom. "' + AND freightcosts.shipperid = '" . $ShipperID . "' + ORDER BY destination"; + $result = DB_query($sql,$db); echo '<br><table class=selection>'; - $TableHeader = "<tr> - <th>" . _('Destination') . "</th> - <th>" . _('Cubic Rate') . "</th> - <th>" . _('KG Rate') . "</th> - <th>" . _('MAX KGs') . "</th> - <th>" . _('MAX Volume') . "</th> - <th>" . _('Fixed Price') . "</th> - <th>" . _('Minimum Charge') . "</th> - </tr>"; + $TableHeader = '<tr> + <th>' . _('Destination') . '</th> + <th>' . _('Cubic Rate') . '</th> + <th>' . _('KG Rate') . '</th> + <th>' . _('MAX KGs') . '</th> + <th>' . _('MAX Volume') . '</th> + <th>' . _('Fixed Price') . '</th> + <th>' . _('Minimum Charge') . '</th> + </tr>'; echo $TableHeader; @@ -233,15 +230,15 @@ } - printf("<td>%s</td> + printf('<td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td><a href=\"%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s\">" . _('Edit') . "</td> - <td><a href=\"%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s&delete=yes\">" . _('Delete') . "</td></tr>", + <td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s">' . _('Edit') . '</td> + <td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this freight cost') . '\');">' . _('Delete') . '</td></tr>', $myrow[1], $myrow[2], $myrow[3], @@ -249,11 +246,11 @@ $myrow[5], $myrow[6], $myrow[7], - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0], $LocationFrom, $ShipperID, - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0], $LocationFrom, $ShipperID); @@ -267,28 +264,28 @@ //end of ifs and buts! if (isset($SelectedFreightCost)) { - echo "<div class='centre'><a href='" . $_SERVER['PHP_SELF'] . "?" . SID . '&LocationFrom=' . $LocationFrom . '&ShipperID=' . $ShipperID . "'>" . _('Show all freight costs for') . ' ' . $ShipperName . ' ' . _('from') . ' ' . $LocationName . '</a></div>'; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?LocationFrom=' . $LocationFrom . '&ShipperID=' . $ShipperID . '">' . _('Show all fr... [truncated message content] |
From: <dai...@us...> - 2011-05-14 11:24:31
|
Revision: 4566 http://web-erp.svn.sourceforge.net/web-erp/?rev=4566&view=rev Author: daintree Date: 2011-05-14 11:24:22 +0000 (Sat, 14 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/COGSGLPostings.php trunk/ContractBOM.php trunk/CreditStatus.php trunk/CustomerBranches.php trunk/CustomerInquiry.php trunk/CustomerReceipt.php trunk/DailyBankTransactions.php trunk/FTP_RadioBeacon.php trunk/FreightCosts.php trunk/POReport.php trunk/PageSecurity.php trunk/Prices.php trunk/StockQties_csv.php trunk/StockTransfers.php trunk/SupplierCredit.php trunk/TaxCategories.php trunk/doc/Change.log Modified: trunk/COGSGLPostings.php =================================================================== --- trunk/COGSGLPostings.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/COGSGLPostings.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -92,7 +92,7 @@ </tr>'; $k=0; //row colour counter - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -106,24 +106,24 @@ <td>%s</td> <td>%s</td> <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> - <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">'. _('Delete') . '</td></tr>', - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + <td><a href="%sSelectedCOGSPostingID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this COGS GL posting record?') . '\');">'. _('Delete') . '</td></tr>', + $myrow['area'], + $myrow['stkcat'], + $myrow['salestype'], + $myrow['accountname'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], + $myrow['id'], $_SERVER['PHP_SELF']. '?', - $myrow[0]); + $myrow['id']); }//end while echo '</table>'; } $sql = "SELECT cogsglpostings.id, - cogsglpostings.area, - cogsglpostings.stkcat, - cogsglpostings.salestype - FROM cogsglpostings"; + cogsglpostings.area, + cogsglpostings.stkcat, + cogsglpostings.salestype + FROM cogsglpostings"; $result = DB_query($sql,$db); @@ -147,7 +147,7 @@ $result = DB_query($sql,$db); } - $sql = "SELECT accountcode FROM chartmaster WHERE accountcode ='1' "; + $sql = "SELECT accountcode FROM chartmaster WHERE accountcode ='1'"; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ /* account number 1 is not used, so insert a new account */ @@ -195,7 +195,7 @@ <th>' . _('GL Account') . '</th> </tr>'; $k = 0; - while ($myrow = DB_fetch_row($result)) { + while ($myrow = DB_fetch_array($result)) { if ($k==1){ echo '<tr class="EvenTableRows">'; $k=0; @@ -211,14 +211,14 @@ <td><a href="%sSelectedCOGSPostingID=%s">' . _('Edit') . '</td> <td><a href="%sSelectedCOGSPostingID=%s&delete=yes">' . _('Delete') . '</td> </tr>', - $myrow[1], - $myrow[2], - $myrow[3], - $myrow[4], + $myrow['area'], + $myrow['stkcat'], + $myrow['salestype'], + $myrow['salestype'], $_SERVER['PHP_SELF'] . '?', - $myrow[0], + $myrow['id'], $_SERVER['PHP_SELF'] . '?', - $myrow[0]); + $myrow['id']); }//END WHILE LIST LOOP echo '</table>'; @@ -305,7 +305,7 @@ echo '</select></td></tr> <tr><td>' . _('Sales Type') . ' / ' . _('Price List') . ':</td> <td><select tabindex=3 name="SalesType"> - <option VALUE="AN">' . _('Any Other') . '</option>'; + <option value="AN">' . _('Any Other') . '</option>'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['SalesType']) and $myrow['typeabbrev']==$_POST['SalesType']) { Modified: trunk/ContractBOM.php =================================================================== --- trunk/ContractBOM.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/ContractBOM.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -323,8 +323,7 @@ <td><input type="text" name="StockCode" size="15" maxlength="18" value="' . $_POST['StockCode'] . '" /></td> </tr> <tr><td></td> - <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php?' . SID . - '">' . _('Create a New Stock Item') . '</a></font></td></tr> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="2"><a target="_blank" href="'.$rootpath.'/Stocks.php">' . _('Create a New Stock Item') . '</a></font></td></tr> </table><br /> <div class="centre"><input type="submit" name="Search" value="' . _('Search Now') . '" /> </div><br />'; Modified: trunk/CreditStatus.php =================================================================== --- trunk/CreditStatus.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CreditStatus.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,8 +1,7 @@ <?php -/* $Revision: 1.16 $ */ + /* $Id$*/ -//$PageSecurity = 3; include('includes/session.inc'); $title = _('Credit Status Code Maintenance'); include('includes/header.inc'); @@ -127,7 +126,7 @@ } else { //only delete if used in neither customer or supplier accounts - $sql="DELETE FROM holdreasons WHERE reasoncode=$SelectedReason"; + $sql="DELETE FROM holdreasons WHERE reasoncode='" . $SelectedReason . "'"; $result = DB_query($sql,$db); prnMsg(_('This credit status code has been deleted'),'success'); } @@ -154,9 +153,9 @@ <th>'. _('Disallow Invoices') .'</th>'; $k=0; //row colour counter - while ($myrow=DB_fetch_row($result)) { + while ($myrow=DB_fetch_array($result)) { - if ($myrow[2]==0) { + if ($myrow['dissallowinvoices']==0) { $DissallowText = _('Invoice OK'); } else { $DissallowText = '<b>'. _('NO INVOICING') .'</b>'; @@ -169,20 +168,20 @@ $k=1; } - printf("<td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href=\"%s?SelectedReason=%s\">" . _('Edit') . "</a></td> - <td><a href=\"%s?SelectedReason=%s&delete=1\">". _('Delete') .'</a></td> - </tr>', - $myrow[0], - $myrow[1], - $DissallowText, - $_SERVER['PHP_SELF'], - $myrow[0], - $_SERVER['PHP_SELF'], - $myrow[0]); - + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%s?SelectedReason=%s">' . _('Edit') . '</a></td> + <td><a href="%s?SelectedReason=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this credit stuatus record?') . '\');">'. _('Delete') .'</a></td> + </tr>', + $myrow['reasoncode'], + $myrow['reasondescription'], + $DissallowText, + $_SERVER['PHP_SELF'], + $myrow['reasoncode'], + $_SERVER['PHP_SELF'], + $myrow['reasoncode']); + } //END WHILE LIST LOOP echo '</table>'; @@ -213,9 +212,9 @@ $_POST['ReasonDescription'] = $myrow['reasondescription']; $_POST['DisallowInvoices'] = $myrow['dissallowinvoices']; - echo "<input type=hidden name='SelectedReason' VALUE='" . $SelectedReason . "'>"; - echo "<input type=hidden name='ReasonCode' VALUE='" . $_POST['ReasonCode'] . "'>"; - echo "<table class=selection><tr><td>". _('Status Code') .':</td><td>'; + echo '<input type="hidden" name="SelectedReason" value="' . $SelectedReason . '">'; + echo '<input type="hidden" name="ReasonCode" value="' . $_POST['ReasonCode'] . '">'; + echo '<table class="selection"><tr><td>'. _('Status Code') .':</td><td>'; echo $_POST['ReasonCode'] . '</td></tr>'; } else { //end of if $SelectedReason only do the else when a new record is being entered @@ -224,10 +223,9 @@ } echo '<br><table class=selection> <tr> - <td>'. _('Status Code') .":</td> - <td><input " . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . - " tabindex=1 type='Text' name='ReasonCode' VALUE='". $_POST['ReasonCode'] ."' size=3 maxlength=2></td> - </tr>"; + <td>'. _('Status Code') .':</td> + <td><input ' . (in_array('ReasonCode',$Errors) ? 'class="inputerror"' : '' ) . ' tabindex=1 type="text" name="ReasonCode" value="'. $_POST['ReasonCode'] .'" size=3 maxlength=2></td> + </tr>'; } if (!isset($_POST['ReasonDescription'])) { @@ -247,4 +245,4 @@ echo '</table><br><div class="centre"><input tabindex=4 type="submit" name="submit" value="' . _('Enter Information') . '"></div></form>'; } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerBranches.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -97,8 +97,8 @@ $row = DB_fetch_array($resultgeo); $api_key = $row['geocode_key']; $map_host = $row['map_host']; - define("MAPS_HOST", $map_host); - define("KEY", $api_key); + define('MAPS_HOST', $map_host); + define('KEY', $api_key); if ($map_host=="") { // check that some sane values are setup already in geocode tables, if not skip the geocoding but add the record anyway. echo '<div class="warn">' . _('Warning - Geocode Integration is enabled, but no hosts are setup. Go to Geocode Setup') . '</div>'; @@ -417,8 +417,12 @@ $DebtorNo, urlencode($myrow[1]), _('Delete Branch')); - if ($myrow[11]){ $TotalDisable++; } - else { $TotalEnable++; } + + if ($myrow[11]){ + $TotalDisable++; + }else { + $TotalEnable++; + } } while ($myrow = DB_fetch_row($result)); //END WHILE LIST LOOP @@ -628,9 +632,9 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['Salesman']) and $myrow['salesmancode']==$_POST['Salesman']) { - echo '<option selected VALUE='; + echo '<option selected value='; } else { - echo '<option VALUE='; + echo '<option value='; } echo $myrow['salesmancode'] . '>' . $myrow['salesmanname']; @@ -654,11 +658,11 @@ echo '<td><select tabindex=14 name="Area">'; while ($myrow = DB_fetch_array($result)) { if (isset($_POST['Area']) and $myrow['areacode']==$_POST['Area']) { - echo '<option selected VALUE='; + echo '<option selected value="'; } else { - echo '<option VALUE='; + echo '<option value="'; } - echo $myrow['areacode'] . '>' . $myrow['areadescription']; + echo $myrow['areacode'] . '">' . $myrow['areadescription']; } //end while loop @@ -666,7 +670,7 @@ echo '</select></td></tr>'; DB_data_seek($result,0); - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, locationname FROM locations"; $result = DB_query($sql,$db); if (DB_num_rows($result)==0){ @@ -682,11 +686,11 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['DefaultLocation']) and $myrow['loccode']==$_POST['DefaultLocation']) { - echo '<option selected value='; + echo '<option selected value="'; } else { - echo '<option value='; + echo '<option value="'; } - echo $myrow['loccode'] . '>' . $myrow['locationname'] . '</option>'; + echo $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } //end while loop @@ -714,11 +718,11 @@ while ($myrow = DB_fetch_array($result)) { if (isset($_POST['TaxGroup']) and $myrow['taxgroupid']==$_POST['TaxGroup']) { - echo '<option selected VALUE='; + echo '<option selected value="'; } else { - echo '<option VALUE='; + echo '<option value="'; } - echo $myrow['taxgroupid'] . '>' . $myrow['taxgroupdescription'] . '</option>'; + echo $myrow['taxgroupid'] . '">' . $myrow['taxgroupdescription'] . '</option>'; } //end while loop @@ -779,7 +783,7 @@ if (!isset($_POST['CustBranchCode'])) {$_POST['CustBranchCode']='';} echo '<td><input tabindex=27 type="Text" name="CustBranchCode" size=31 maxlength=30 value="'. $_POST['CustBranchCode'].'"></td></tr>'; echo '</table>'; - echo '<br /><div class="centre"><input tabindex=28 type="Submit" name="submit" value="' . _('Enter Branch') . '"></div>'; + echo '<br /><div class="centre"><input tabindex=28 type="submit" name="submit" value="' . _('Enter Branch') . '"></div>'; echo '</form>'; } //end if record deleted no point displaying form to add record Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerInquiry.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,12 +1,9 @@ <?php -/* $Revision: 1.30 $ */ /* $Id$*/ include('includes/SQL_CommonFunctions.inc'); -//$PageSecurity = 1; - include('includes/session.inc'); $title = _('Customer Inquiry'); include('includes/header.inc'); @@ -15,7 +12,7 @@ if(!isset($_GET['CustomerID']) AND !isset($_SESSION['CustomerID'])){ prnMsg(_('To display the enquiry a customer must first be selected from the customer selection screen'),'info'); - echo '<br><div class="centre"><a href="'. $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Select a Customer to Inquire On') . '</a><br></div>'; + echo '<br /><div class="centre"><a href="'. $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Select a Customer to Inquire On') . '</a><br /></div>'; include('includes/footer.inc'); exit; } else { @@ -37,6 +34,7 @@ $SQL = "SELECT debtorsmaster.name, currencies.currency, + currencies.decimalplaces, paymentterms.terms, debtorsmaster.creditlimit, holdreasons.dissallowinvoices, @@ -93,18 +91,21 @@ $NIL_BALANCE = True; - $SQL = "SELECT debtorsmaster.name, currencies.currency, paymentterms.terms, - debtorsmaster.creditlimit, holdreasons.dissallowinvoices, holdreasons.reasondescription - FROM debtorsmaster, - paymentterms, - holdreasons, - currencies - WHERE - debtorsmaster.paymentterms = paymentterms.termsindicator - AND debtorsmaster.currcode = currencies.currabrev - AND debtorsmaster.holdreason = holdreasons.reasoncode - AND debtorsmaster.debtorno = '" . $CustomerID . "'"; - + $SQL = "SELECT debtorsmaster.name, + currencies.currency, + currencies.decimalplaces, + paymentterms.terms, + debtorsmaster.creditlimit, + holdreasons.dissallowinvoices, + holdreasons.reasondescription + FROM debtorsmaster INNER JOIN paymentterms + ON debtorsmaster.paymentterms = paymentterms.termsindicator + INNER JOIN holdreasons + ON debtorsmaster.holdreason = holdreasons.reasoncode + INNER JOIN currencies + debtorsmaster.currcode = currencies.currabrev + WHERE debtorsmaster.debtorno = '" . $CustomerID . "'"; + $ErrMsg =_('The customer details could not be retrieved by the SQL because'); $CustomerResult = DB_query($SQL,$db,$ErrMsg); @@ -123,33 +124,32 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/customer.png" title="' . _('Customer') . '" alt="" />' . ' ' . _('Customer') . ' : ' . $CustomerRecord['name'] . ' - (' . _('All amounts stated in') . - ' ' . $CustomerRecord['currency'] . ')<br><br>' . _('Terms') . ' : ' . $CustomerRecord['terms'] . '<br>' . _('Credit Limit') . + ' ' . $CustomerRecord['currency'] . ')<br /><br />' . _('Terms') . ' : ' . $CustomerRecord['terms'] . '<br />' . _('Credit Limit') . ': ' . number_format($CustomerRecord['creditlimit'],0) . ' ' . _('Credit Status') . ': ' . $CustomerRecord['reasondescription'] . '</p>'; if ($CustomerRecord['dissallowinvoices']!=0){ - echo '<br><font color=RED size=4><b>' . _('ACCOUNT ON HOLD') . '</font></b><br>'; + echo '<br /><font color=RED size=4><b>' . _('ACCOUNT ON HOLD') . '</font></b><br />'; } -echo "<table class=selection width=70%> +echo '<table class=selection width=70%> <tr> - <th width=20%>" . _('Total Balance') . "</th> - <th width=20%>" . _('Current') . "</th> - <th width=20%>" . _('Now Due') . "</th> - <th width=20%>" . $_SESSION['PastDueDays1'] . "-" . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . "</th> - <th width=20%>" . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th></tr>'; + <th width=20%>' . _('Total Balance') . '</th> + <th width=20%>' . _('Current') . '</th> + <th width=20%>' . _('Now Due') . '</th> + <th width=20%>' . $_SESSION['PastDueDays1'] . '-' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th> + <th width=20%>' . _('Over') . ' ' . $_SESSION['PastDueDays2'] . ' ' . _('Days Overdue') . '</th></tr>'; -echo '<tr><td class=number>' . number_format($CustomerRecord['balance'],2) . '</td> - <td class=number>' . number_format(($CustomerRecord['balance'] - $CustomerRecord['due']),2) . '</td> - <td class=number>' . number_format(($CustomerRecord['due']-$CustomerRecord['overdue1']),2) . '</td> - <td class=number>' . number_format(($CustomerRecord['overdue1']-$CustomerRecord['overdue2']) ,2) . '</td> - <td class=number>' . number_format($CustomerRecord['overdue2'],2) . '</td> +echo '<tr><td class=number>' . number_format($CustomerRecord['balance'],$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['balance'] - $CustomerRecord['due']),$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['due']-$CustomerRecord['overdue1']),$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format(($CustomerRecord['overdue1']-$CustomerRecord['overdue2']) ,$CustomerRecord['decimalplaces']) . '</td> + <td class=number>' . number_format($CustomerRecord['overdue2'],$CustomerRecord['decimalplaces']) . '</td> </tr> </table>'; -echo "<br><div class='centre'><form action='" . $_SERVER['PHP_SELF'] . "' method=post>"; +echo '<br /><div class="centre"><form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo _('Show all transactions after') . ": <input tabindex=1 type=text class='date' alt='".$_SESSION['DefaultDateFormat']."' id='datepicker' name='TransAfterDate' Value='" . $_POST['TransAfterDate'] . "' MAXLENGTH =10 size=12>" . - " <input tabindex=2 type=submit name='Refresh Inquiry' value='" . _('Refresh Inquiry') . "'></div></form><br>"; +echo _('Show all transactions after') . ': <input tabindex=1 type=text class="date" alt="' .$_SESSION['DefaultDateFormat']. '" id="datepicker" name="TransAfterDate" Value="' . $_POST['TransAfterDate'] . '" maxlength =10 size=12>' . '<input tabindex=2 type="submit" name="Refresh Inquiry" value="' . _('Refresh Inquiry') . '"></div></form><br />'; $DateAfterCriteria = FormatDateForSQL($_POST['TransAfterDate']); @@ -186,21 +186,22 @@ echo '<table class="selection" cellpadding="2" colspan="7">'; $tableheader = '<tr> - <th>' . _('Type') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Reference') . '</th> - <th>' . _('Comments') . '</th> - <th>' . _('Order') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('Allocated') . '</th> - <th>' . _('Balance') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th> - <th>' . _('More Info') . '</th></tr>'; + <th>' . _('Type') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Branch') . '</th> + <th>' . _('Reference') . '</th> + <th>' . _('Comments') . '</th> + <th>' . _('Order') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('Allocated') . '</th> + <th>' . _('Balance') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + <th>' . _('More Info') . '</th> + </tr>'; echo $tableheader; @@ -225,25 +226,26 @@ } $BaseFormatString = '<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td width="200">%s</td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td class=number>%s</td>'; + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td width="200">%s</td> + <td>%s</td> + <td class=number>%s</td> + <td class=number>%s</td> + <td class=number>%s</td>'; + - $CreditInvoiceFormatString = '<td><a href="%s/Credit_Invoice.php?InvoiceNumber=%s">' . _('Credit ') .'<IMG SRC="%s/credit.gif" title="' . _('Click to credit the invoice') . '"></a></td>'; + $CreditInvoiceFormatString = '<td><a href="%s/Credit_Invoice.php?InvoiceNumber=%s">' . _('Credit ') .'<img src="%s/credit.gif" title="' . _('Click to credit the invoice') . '"></a></td>'; - $PreviewInvoiceFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('HTML ') . '<IMG SRC="%s/preview.gif" title="' . _('Click to preview the invoice') . '"></a></td> - <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '<IMG SRC="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> - <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('Email ') . '<IMG SRC="%s/email.gif" title="' . _('Click to email the invoice') . '"></a></td>'; + $PreviewInvoiceFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('HTML ') . '<img src="%s/preview.gif" title="' . _('Click to preview the invoice') . '"></a></td> + <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Invoice&PrintPDF=True">' . _('PDF ') . '<img src="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> + <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Invoice">' . _('Email ') . '<img src="%s/email.gif" title="' . _('Click to email the invoice') . '"></a></td>'; $PreviewCreditFormatString = '<td><a href="%s/PrintCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('HTML ') . ' <IMG SRC="%s/preview.gif" title="' . _('Click to preview the credit note') . '"></a></td> - <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True">' . _('PDF ') . '<IMG SRC="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> - <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('Email') . ' <IMG SRC="%s/email.gif" title="' . _('Click to email the credit note') . '"></a></td>'; + <td><a href="%s/%s?FromTransNo=%s&InvOrCredit=Credit&PrintPDF=True">' . _('PDF ') . '<img src="%s/css/' . $theme . '/images/pdf.png" title="' . _('Click for PDF') . '"></a></td> + <td><a href="%s/EmailCustTrans.php?FromTransNo=%s&InvOrCredit=Credit">' . _('Email') . ' <img src="%s/email.gif" title="' . _('Click to email the credit note') . '"></a></td>'; /* assumed allowed page security token 3 allows the user to create credits for invoices */ if (in_array(3,$_SESSION['AllowedPageSecurityTokens']) && $myrow['type']==10){ @@ -255,7 +257,7 @@ /* format string with GL inquiry options and for invoice to be credited */ printf($BaseFormatString . $CreditInvoiceFormatString . $PreviewInvoiceFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <IMG SRC="' .$rootpath. '/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <img src="' .$rootpath. '/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> </tr>', //$BaseFormatString parameters $myrow['typename'], @@ -265,9 +267,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$CreditInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -279,13 +281,12 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', //Parameter for string for GL Trans Inquiries $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //user does not have privileges to see GL inquiry stuff @@ -299,9 +300,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //CreditInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -313,8 +314,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images'); } @@ -332,9 +333,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewInvoiceFormatString parameters $rootpath, $myrow['transno'], @@ -342,8 +343,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images'); @@ -351,8 +352,8 @@ if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . $PreviewCreditFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - <td><a href='%s/GLTransInquiry.php?%sTypeID=%s&TransNo=%s'>" . _('View GL Entries') . ' <a><IMG SRC="' .$rootpath.'/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td></tr>', + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath .'/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + <td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a><img src="' .$rootpath.'/css/'.$theme.'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td></tr>', //$BaseFormatString parameters $myrow['typename'], $myrow['transno'], @@ -361,9 +362,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewCreditFormatString parameters $rootpath, $myrow['transno'], @@ -371,22 +372,21 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', // hand coded format string for Allocations and GLTrans Inquiry parameters $rootpath, $myrow['id'], $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { printf($BaseFormatString . $PreviewCreditFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='%s/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="%s/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -394,9 +394,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), //$PreviewCreditFormatString parameters $rootpath, $myrow['transno'], @@ -404,8 +404,8 @@ $rootpath, $PrintCustomerTransactionScript, $myrow['transno'], - $rootpath.'/css/'.$theme.'/images', $rootpath, + $rootpath, $myrow['transno'], $rootpath.'/css/'.$theme.'/images', //Parameters for hand coded string to show allocations @@ -418,9 +418,9 @@ //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - <td><a href='%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s'>" . _('View GL Entries') . " <IMG SRC='" .$rootpath."/css/".$theme."/images/gl.png' title='" . _('View the GL Entries') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath . '/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + <td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <img src="' .$rootpath . '/css/' . $theme .'/images/gl.png" title="' . _('View the GL Entries') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -428,19 +428,18 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, $myrow['id'], $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //no permission for GLTrans Inquiries printf($BaseFormatString . - "<td><a href='%s/CustomerAllocations.php?AllocTrans=%s'>" . _('Allocation') . "<IMG SRC='" .$rootpath."/css/".$theme."/images/allocation.png' title='" . _('Click to allocate funds') . "'></a></td> - </tr>", + '<td><a href="%s/CustomerAllocations.php?AllocTrans=%s">' . _('Allocation') . '<img src="' .$rootpath . '/css/' . $theme .'/images/allocation.png" title="' . _('Click to allocate funds') . '"></a></td> + </tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -448,9 +447,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, $myrow['id']); } @@ -459,7 +458,7 @@ //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -467,11 +466,10 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { //no permission for GLTrans Inquiries @@ -483,15 +481,15 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2)); + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces'])); } } else { //If security token 8 in the allowed page security tokens then assumed ok for GL trans inquiries if ($_SESSION['CompanyRecord']['gllink_debtors']== 1 AND in_array(8,$_SESSION['AllowedPageSecurityTokens'])){ printf($BaseFormatString . - '<td><a href="%s/GLTransInquiry.php?%s&TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', + '<td><a href="%s/GLTransInquiry.php?TypeID=%s&TransNo=%s">' . _('View GL Entries') . ' <a></td></tr>', $myrow['typename'], $myrow['transno'], ConvertSQLDate($myrow['trandate']), @@ -499,11 +497,10 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2), + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces']), $rootpath, - SID, $myrow['type'], $myrow['transno']); } else { @@ -515,9 +512,9 @@ $myrow['reference'], $myrow['invtext'], $myrow['order_'], - number_format($myrow['totalamount'],2), - number_format($myrow['allocated'],2), - number_format($myrow['totalamount']-$myrow['allocated'],2)); + number_format($myrow['totalamount'],$CustomerRecord['decimalplaces']), + number_format($myrow['allocated'],$CustomerRecord['decimalplaces']), + number_format($myrow['totalamount']-$myrow['allocated'],$CustomerRecord['decimalplaces'])); } } @@ -526,4 +523,4 @@ echo '</table>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/CustomerReceipt.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -700,7 +700,7 @@ /*set up the form whatever */ -echo '<form action=' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . ' method=post name=form1>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '?Type='.$_GET['Type'] . '" method=post name=form1>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; /*show the batch header details and the entries in the batch so far */ Modified: trunk/DailyBankTransactions.php =================================================================== --- trunk/DailyBankTransactions.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/DailyBankTransactions.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,6 +1,7 @@ <?php -//$PageSecurity = 8; now from Database Scripts table +/* $Id: DailyBankTransactions.php 4556 2011-04-26 11:03:36Z daintree $ */ + include ('includes/session.inc'); $title = _('Bank Transactions Inquiry'); include('includes/header.inc'); @@ -9,23 +10,24 @@ _('Search') . '" alt="" />' . ' ' . $title.'</p>'; if (!isset($_POST['Show'])) { - echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<table class=selection>'; - $SQL = 'SELECT bankaccountname, - bankaccounts.accountcode, - bankaccounts.currcode - FROM bankaccounts, - chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + $SQL = "SELECT bankaccountname, + bankaccounts.accountcode, + bankaccounts.currcode + FROM bankaccounts, + chartmaster + WHERE bankaccounts.accountcode=chartmaster.accountcode"; $ErrMsg = _('The bank accounts could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the bank accounts was'); $AccountsResults = DB_query($SQL,$db,$ErrMsg,$DbgMsg); - echo '<tr><td>' . _('Bank Account') . ':</td><td><select name="BankAccount">'; + echo '<tr><td>' . _('Bank Account') . ':</td> + <td><select name="BankAccount">'; if (DB_num_rows($AccountsResults)==0){ echo '</select></td></tr></table><p>'; @@ -60,30 +62,33 @@ echo '</form>'; } else { $SQL = "SELECT bankaccountname, - bankaccounts.currcode - FROM bankaccounts - WHERE bankaccounts.accountcode='" . $_POST['BankAccount'] . "'"; + bankaccounts.currcode, + currencies.decimalplaces + FROM bankaccounts + INNER JOIN currencies + ON bankaccounts.currcode = currencies.currabrev + WHERE bankaccounts.accountcode='" . $_POST['BankAccount'] . "'"; $BankResult = DB_query($SQL,$db,_('Could not retrieve the bank account details')); $sql="SELECT banktrans.currcode, - banktrans.amount, - banktrans.functionalexrate, - banktrans.exrate, - banktrans.banktranstype, - banktrans.transdate, - bankaccounts.bankaccountname, - systypes.typename, - systypes.typeid - FROM banktrans - INNER JOIN bankaccounts - ON banktrans.bankact=bankaccounts.accountcode - INNER JOIN systypes - ON banktrans.type=systypes.typeid - WHERE bankact='".$_POST['BankAccount']."' - AND transdate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' - AND transdate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' - ORDER BY banktrans.transdate"; + banktrans.amount, + banktrans.functionalexrate, + banktrans.exrate, + banktrans.banktranstype, + banktrans.transdate, + bankaccounts.bankaccountname, + systypes.typename, + systypes.typeid + FROM banktrans + INNER JOIN bankaccounts + ON banktrans.bankact=bankaccounts.accountcode + INNER JOIN systypes + ON banktrans.type=systypes.typeid + WHERE bankact='".$_POST['BankAccount']."' + AND transdate>='" . FormatDateForSQL($_POST['FromTransDate']) . "' + AND transdate<='" . FormatDateForSQL($_POST['ToTransDate']) . "' + ORDER BY banktrans.transdate"; $result = DB_query($sql, $db); if (DB_num_rows($result)==0) { prnMsg(_('There are no transactions for this account in the date range selected'), 'info'); @@ -94,15 +99,15 @@ <th colspan=7><font size=3 color=blue>' . _('Account Transactions For').' '.$BankDetailRow['bankaccountname'].' '._('Between').' '.$_POST['FromTransDate'] . ' ' . _('and') . ' ' . $_POST['ToTransDate'] . '</font></th> </tr>'; echo '<tr> - <th>' . ('Date') . '</th> - <th>'._('Transaction type').'</th> - <th>'._('Type').'</th> - <th>'._('Reference').'</th> - <th>'._('Amount in').' '.$BankDetailRow['currcode'].'</th> - <th>'._('Running Total').' '.$BankDetailRow['currcode'].'</th> - <th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> - <th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> - </tr>'; + <th>' . ('Date') . '</th> + <th>'._('Transaction type').'</th> + <th>'._('Type').'</th> + <th>'._('Reference').'</th> + <th>'._('Amount in').' '.$BankDetailRow['currcode'].'</th> + <th>'._('Running Total').' '.$BankDetailRow['currcode'].'</th> + <th>'._('Amount in').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> + <th>'._('Running Total').' '.$_SESSION['CompanyRecord']['currencydefault'].'</th> + </tr>'; $AccountCurrTotal=0; $LocalCurrTotal =0; @@ -113,20 +118,20 @@ $LocalCurrTotal += $myrow['amount']/$myrow['functionalexrate']/$myrow['exrate']; echo '<tr> - <td>'. ConvertSQLDate($myrow['transdate']) . '</td> - <td>'.$myrow['typename'].'</td> - <td>'.$myrow['banktranstype'].'</td> - <td>'.$myrow['ref'].'</td> - <td class=number>'.number_format($myrow['amount'],2).'</td> - <td class=number>'.number_format($AccountCurrTotal,2).'</td> - <td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],2).'</td> - <td class=number>'.number_format($LocalCurrTotal,2).'</td> - </tr>'; + <td>'. ConvertSQLDate($myrow['transdate']) . '</td> + <td>'.$myrow['typename'].'</td> + <td>'.$myrow['banktranstype'].'</td> + <td>'.$myrow['ref'].'</td> + <td class=number>'.number_format($myrow['amount'],$BankDetailRow['decimalplaces']).'</td> + <td class=number>'.number_format($AccountCurrTotal,$BankDetailRow['decimalplaces']).'</td> + <td class=number>'.number_format($myrow['amount']/$myrow['functionalexrate']/$myrow['exrate'],$_SESSION['CompanyRecord']['decimalplaces']).'</td> + <td class=number>'.number_format($LocalCurrTotal,$_SESSION['CompanyRecord']['decimalplaces']).'</td> + </tr>'; } echo '</table>'; } //end if no bank trans in the range to show - echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post>'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br><div class="centre"><input type="submit" name="Return" value="' . _('Select Another Date'). '"></div>'; echo '</form>'; Modified: trunk/FTP_RadioBeacon.php =================================================================== --- trunk/FTP_RadioBeacon.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/FTP_RadioBeacon.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,10 +1,9 @@ <?php -/* $Revision: 1.10 $ */ + /* $Id$*/ /*Variables required to configure this script must be set in config.php */ -//$PageSecurity = 2; include('includes/session.inc'); $title=_('FTP order to Radio Beacon'); include('includes/header.inc'); @@ -47,17 +46,17 @@ echo '<table cellpadding=2 colspan=7 WIDTH=100%>'; $TableHeader = '<tr> - <td class=tableheader>' . _('Modify') . '</td> - <td class=tableheader>' . _('Send to') . '<br>' . _('Radio Beacon') . '</td> - <td class=tableheader>' . _('Customer') . '</td> - <td class=tableheader>' . _('Branch') . '</td> - <td class=tableheader>' . _('Cust Order') . ' #</td> - <td class=tableheader>' . _('Order Date') . '</td> - <td class=tableheader>' . _('Req Del Date') . '</td> - <td class=tableheader>' . _('Delivery To') . '</td> - <td class=tableheader>' . _('Order Total') . '</td> - <td class=tableheader>' . _('Last Send') . '</td> - </tr>'; + <td class=tableheader>' . _('Modify') . '</td> + <td class=tableheader>' . _('Send to') . '<br />' . _('Radio Beacon') . '</td> + <td class=tableheader>' . _('Customer') . '</td> + <td class=tableheader>' . _('Branch') . '</td> + <td class=tableheader>' . _('Cust Order') . ' #</td> + <td class=tableheader>' . _('Order Date') . '</td> + <td class=tableheader>' . _('Req Del Date') . '</td> + <td class=tableheader>' . _('Delivery To') . '</td> + <td class=tableheader>' . _('Order Total') . '</td> + <td class=tableheader>' . _('Last Send') . '</td> + </tr>'; echo $TableHeader; @@ -72,7 +71,7 @@ $k=1; } - $FTPDispatchNote = $_SERVER['PHP_SELF'] . '?' . SID . '&OrderNo=' . $myrow['orderno']; + $FTPDispatchNote = $_SERVER['PHP_SELF'] . '?OrderNo=' . $myrow['orderno']; $FormatedDelDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedOrderValue = number_format($myrow['ordervalue'],2); @@ -80,48 +79,48 @@ $ModifyPage = $rootpath . 'SelectOrderItems.php?' . SID . '&ModifyOrderNumber=' . $myrow['orderno']; if ($myrow['printedpackingslip'] ==1){ - printf("<td><font size=2><a href='%s'>%s</a></font></td> - <td><font color=RED size=2>" . _('Already') . '<br>' . _('Sent') . "</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td class=number><font size=2>%s</font></td> - <td><font size=2>%s</font></td></tr>", - $ModifyPage, - $myrow['orderno'], - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedOrderDate, - $FormatedDelDate, - $myrow['deliverto'], - $FormatedOrderValue, - $FormatedDateLastSent); + printf('<td><font size=2><a href="%s">%s</a></font></td> + <td><font color=RED size=2>' . _('Already') . '<br />' . _('Sent') . '</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td class=number><font size=2>%s</font></td> + <td><font size=2>%s</font></td></tr>', + $ModifyPage, + $myrow['orderno'], + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedOrderDate, + $FormatedDelDate, + $myrow['deliverto'], + $FormatedOrderValue, + $FormatedDateLastSent); } else { - printf("<td><font size=2><a href='%s'>%s</a></font></td> - <td><font size=2><a href='%s'>" . _('Send') . "</a></font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td><font size=2>%s</font></td> - <td class=number><font size=2>%s</font></td> - <td><font size=2>%s</font></td></tr>", - $ModifyPage, - $myrow['orderno'], - $FTPDispatchNote, - $myrow['name'], - $myrow['brname'], - $myrow['customerref'], - $FormatedOrderDate, - $FormatedDelDate, - $myrow['deliverto'], - $FormatedOrderValue, - $FormatedDateLastSent); + printf('<td><font size=2><a href="%s">%s</a></font></td> + <td><font size=2><a href="%s">' . _('Send') . '</a></font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td><font size=2>%s</font></td> + <td class=number><font size=2>%s</font></td> + <td><font size=2>%s</font></td></tr>', + $ModifyPage, + $myrow['orderno'], + $FTPDispatchNote, + $myrow['name'], + $myrow['brname'], + $myrow['customerref'], + $FormatedOrderDate, + $FormatedDelDate, + $myrow['deliverto'], + $FormatedOrderValue, + $FormatedDateLastSent); } $j++; if ($j == 12){ @@ -173,7 +172,7 @@ debtorsmaster WHERE salesorders.debtorno=debtorsmaster.debtorno AND salesorders.fromstkloc = '". $_SESSION['RadioBeaconStockLocation'] . "' - AND salesorders.orderno=" . $_GET['OrderNo']; + AND salesorders.orderno='" . $_GET['OrderNo'] . "'"; $ErrMsg = _('There was a problem retrieving the order header details for Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('from the database'); @@ -183,24 +182,24 @@ $myrow = DB_fetch_array($result); if ($myrow['printedpackingslip']==1){ - prnMsg(_('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has previously been sent to Radio Beacon') . '. ' . _('It was sent on') . ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) . '<br>' . _('To re-send the order with the balance not previously dispatched and invoiced the order must be modified to allow a reprint (or re-send)') . '.<br>' . _('This check is there to ensure that duplication of dispatches to the customer are avoided'),'warn'); - echo "<p><a href='$rootpath/SelectOrderItems.php?" . SID . "&ModifyOrderNumber=" . $_GET['OrderNo'] . "'>" . _('Modify the order to allow a re-send or reprint') . ' (' . _('Select Delivery Details') . ')' . '</a>'; - echo "<p><a href='$rootpath/index.php'>" . _('Back to the menu') . '</a>'; + prnMsg(_('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has previously been sent to Radio Beacon') . '. ' . _('It was sent on') . ' ' . ConvertSQLDate($myrow['datepackingslipprinted']) . '<br />' . _('To re-send the order with the balance not previously dispatched and invoiced the order must be modified to allow a reprint (or re-send)') . '.<br />' . _('This check is there to ensure that duplication of dispatches to the customer are avoided'),'warn'); + echo '<p><a href="' . $rootpath . '/SelectOrderItems.php?ModifyOrderNumber=' . $_GET['OrderNo'] . '">' . _('Modify the order to allow a re-send or reprint') . ' (' . _('Select Delivery Details') . ')' . '</a>'; + echo '<p><a href="' . $rootpath/index.php . '">' . _('Back to the menu') . '</a>'; include('includes/footer.inc'); exit; } /*Now get the line items */ $sql = "SELECT stkcode, - description, - quantity, - units, - qtyinvoiced, - unitprice - FROM salesorderdetails, - stockmaster - WHERE salesorderdetails.stkcode=stockmaster.stockid - AND salesorderdetails.orderno=" . $_GET['OrderNo']; + description, + quantity, + units, + qtyinvoiced, + unitprice + FROM salesorderdetails, + stockmaster + WHERE salesorderdetails.stkcode=stockmaster.stockid + AND salesorderdetails.orderno=" . $_GET['OrderNo']; $ErrMsg = _('There was a problem retrieving the line details for order number') . ' ' . $_GET['OrderNo'] . ' ' . _('from the database because'); $result=DB_query($sql,$db, $ErrMsg); @@ -267,18 +266,18 @@ $conn_id = ftp_connect($_SESSION['RadioBeaconFTP_server']); // login with username and password $login_result = ftp_login($conn_id, $_SESSION['RadioBeaconFTP_user_name'], $_SESSION['RadioBeaconFTP_user_pass']); // check connection if ((!$conn_id) || (!$login_result)) { - echo '<br>' . _('Ftp connection has failed'); - echo '<br>' . _('Attempted to connect to') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('for user') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; + echo '<br />' . _('Ftp connection has failed'); + echo '<br />' . _('Attempted to connect to') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('for user') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; die; } else { - echo '<br>' . _('Connected to Radio Beacon FTP server at') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('with user name') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; + echo '<br />' . _('Connected to Radio Beacon FTP server at') . ' ' . $_SESSION['RadioBeaconFTP_server'] . ' ' . _('with user name') . ' ' . $_SESSION['RadioBeaconFTP_user_name']; } // upload the file $upload = ftp_put($conn_id, $FilePrefix . $FileNumber . '.txt', $FileName, FTP_ASCII); // check upload status if (!$upload) { prnMsg(_('FTP upload has failed'),'success'); exit; } else { - echo '<br>' . _('Uploaded') . ' ' . $FileName . ' ' . _('to') . ' ' . $_SESSION['RadioBeaconFTP_server']; + echo '<br />' . _('Uploaded') . ' ' . $FileName . ' ' . _('to') . ' ' . $_SESSION['RadioBeaconFTP_server']; } // close the FTP stream ftp_quit($conn_id); @@ -286,7 +285,7 @@ $sql = "UPDATE salesorders SET printedpackingslip=1, datepackingslipprinted='" . Date('Y-m-d') . "' WHERE salesorders.orderno=" . $_GET['OrderNo']; $result = DB_query($sql,$db); - echo '<p>' . _('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has been sent via FTP to Radio Beacon a copy of the file that was sent is held on the server at') . '<br>' . $FileName; + echo '<p>' . _('Order Number') . ' ' . $_GET['OrderNo'] . ' ' . _('has been sent via FTP to Radio Beacon a copy of the file that was sent is held on the server at') . '<br />' . $FileName; } else { /*perhaps several order headers returned or none (more likely) */ Modified: trunk/FreightCosts.php =================================================================== --- trunk/FreightCosts.php 2011-05-13 10:50:42 UTC (rev 4565) +++ trunk/FreightCosts.php 2011-05-14 11:24:22 UTC (rev 4566) @@ -1,17 +1,11 @@ <?php /* $Id$*/ -/* $Revision: 1.14 $ */ -//$PageSecurity = 11; include('includes/session.inc'); $title = _('Freight Costs Set Up'); include('includes/header.inc'); -?> - -<?php - if (isset($_GET['LocationFrom'])){ $LocationFrom = $_GET['LocationFrom']; } elseif (isset($_POST['LocationFrom'])){ @@ -33,32 +27,37 @@ if (!isset($LocationFrom) OR !isset($ShipperID)) { - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . '?' . SID . "'>"; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - $sql = 'SELECT shippername, shipper_id FROM shippers'; + $sql = "SELECT shippername, shipper_id FROM shippers"; $ShipperResults = DB_query($sql,$db); echo '<table class=selection> <tr> - <td>' . _('Select A Freight Company to set up costs for') . "</td> - <td><select name='ShipperID'>"; + <td>' . _('Select A Freight Company to set up costs for') . '</td> + <td><select name="ShipperID">'; while ($myrow = DB_fetch_array($ShipperResults)){ - echo '<option VALUE=' . $myrow['shipper_id'] . '>' . $myrow['shippername']; + echo '<option value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; } echo '</select></td></tr> <tr> - <td>' . _('Select the warehouse') . ' (' . _('ship from location') . ")</td> - <td><select name='LocationFrom'>"; + <td>' . _('Select the warehouse') . ' (' . _('ship from location') . ')</td> + <td><select name="LocationFrom">'; - $sql = 'SELECT loccode, locationname FROM locations'; + $sql = "SELECT loccode, + locationname + FROM locations"; $LocationResults = DB_query($sql,$db); while ($myrow = DB_fetch_array($LocationResults)){ - echo '<option VALUE=' . $myrow['loccode'] . '>' . $myrow['locationname']; + echo '<option value=' . $myrow['loccode'] . '>' . $myrow['locationname']; } - echo "</select></td></tr></table><br><div class='centre'><input type=submit value='" . _('Accept') . "' name='Accept'></div></form>"; + echo '</select></td></tr> + </table> + <br><div class="centre"><input type="submit" value="' . _('Accept') . '" name="Accept"></div> + </form>'; } else { @@ -115,8 +114,7 @@ if (isset($SelectedFreightCost) AND $InputError !=1) { $sql = "UPDATE freightcosts - SET - locationfrom='".$LocationFrom."', + SET locationfrom='".$LocationFrom."', destination='" . $_POST['Destination'] . "', shipperid='" . $ShipperID . "', cubrate='" . $_POST['CubRate'] . "', @@ -133,28 +131,27 @@ /*Selected freight cost is null cos no item selected on first time round so must be adding a record must be submitting new entries */ - $sql = "INSERT INTO freightcosts ( - locationfrom, - destination, - shipperid, - cubrate, - kgrate, - maxkgs, - maxcub, - fixedprice, - minimumchg) - VALUES ( - '".$LocationFrom."', - '" . $_POST['Destination'] . "', - '" . $ShipperID . "', - '" . $_POST['CubRate'] . "', - '" . $_POST['KGRate'] . "', - '" . $_POST['MAXKGs'] . "', - '" . $_POST['MAXCub'] . "', - '" . $_POST['FixedPrice'] ."', - '" . $_POST['MinimumChg'] . "' - )"; - + $sql = "INSERT INTO freightcosts (locationfrom, + destination, + shipperid, + cubrate, + kgrate, + maxkgs, + maxcub, + fixedprice, + minimumchg) + VALUES ( + '".$LocationFrom."', + '" . $_POST['Destination'] . "', + '" . $ShipperID . "', + '" . $_POST['CubRate'] . "', + '" . $_POST['KGRate'] . "', + '" . $_POST['MAXKGs'] . "', + '" . $_POST['MAXCub'] . "', + '" . $_POST['FixedPrice'] ."', + '" . $_POST['MinimumChg'] . "' + )"; + $msg = _('Freight cost record inserted'); } @@ -187,30 +184,30 @@ $sql = "SELECT shipcostfromid, - destination, - cubrate, - kgrate, - maxkgs, - maxcub, - fixedprice, - minimumchg - FROM freightcosts - WHERE freightcosts.locationfrom = '".$LocationFrom. "' - AND freightcosts.shipperid = '" . $ShipperID . "' - ORDER BY destination"; - + destination, + cubrate, + kgrate, + maxkgs, + maxcub, + fixedprice, + minimumchg + FROM freightcosts + WHERE freightcosts.locationfrom = '".$LocationFrom. "' + AND freightcosts.shipperid = '" . $ShipperID . "' + ORDER BY destination"; + $result = DB_query($sql,$db); echo '<br><table class=selection>'; - $TableHeader = "<tr> - <th>" . _('Destination') . "</th> - <th>" . _('Cubic Rate') . "</th> - <th>" . _('KG Rate') . "</th> - <th>" . _('MAX KGs') . "</th> - <th>" . _('MAX Volume') . "</th> - <th>" . _('Fixed Price') . "</th> - <th>" . _('Minimum Charge') . "</th> - </tr>"; + $TableHeader = '<tr> + <th>' . _('Destination') . '</th> + <th>' . _('Cubic Rate') . '</th> + <th>' . _('KG Rate') . '</th> + <th>' . _('MAX KGs') . '</th> + <th>' . _('MAX Volume') . '</th> + <th>' . _('Fixed Price') . '</th> + <th>' . _('Minimum Charge') . '</th> + </tr>'; echo $TableHeader; @@ -233,15 +230,15 @@ } - printf("<td>%s</td> + printf('<td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - <td><a href=\"%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s\">" . _('Edit') . "</td> - <td><a href=\"%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s&delete=yes\">" . _('Delete') . "</td></tr>", + <td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s">' . _('Edit') . '</td> + <td><a href="%s&SelectedFreightCost=%s&LocationFrom=%s&ShipperID=%s&delete=yes" onclick="return confirm(\'' . _('Are you sure you wish to delete this freight cost') . '\');">' . _('Delete') . '</td></tr>', $myrow[1], $myrow[2], $myrow[3], @@ -249,11 +246,11 @@ $myrow[5], $myrow[6], $myrow[7], - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0], $LocationFrom, $ShipperID, - $_SERVER['PHP_SELF'] . '?' . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0], $LocationFrom, $ShipperID); @@ -267,28 +264,28 @@ //end of ifs and buts! if (isset($SelectedFreightCost)) { - echo "<div class='centre'><a href='" . $_SERVER['PHP_SELF'] . "?" . SID . '&LocationFrom=' . $LocationFrom . '&ShipperID=' . $ShipperID . "'>" . _('Show all freight costs for') . ' ' . $ShipperName . ' ' . _('from') . ' ' . $LocationName . '</a></div>'; + echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?LocationFrom=' . $LocationFrom . '&ShipperID=' . $ShipperID . '">' . _('Show all fr... [truncated message content] |
From: <dai...@us...> - 2011-05-13 10:50:51
|
Revision: 4565 http://web-erp.svn.sourceforge.net/web-erp/?rev=4565&view=rev Author: daintree Date: 2011-05-13 10:50:42 +0000 (Fri, 13 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/BOMs.php trunk/Factors.php trunk/GLJournal.php trunk/GLTags.php trunk/GoodsReceived.php trunk/MRPDemands.php trunk/OffersReceived.php trunk/PO_AuthorisationLevels.php trunk/PO_AuthoriseMyOrders.php trunk/PO_SelectPurchOrder.php trunk/Payments.php trunk/PcAssignCashToTab.php trunk/PcClaimExpensesFromTab.php trunk/PcTabs.php trunk/Prices.php trunk/Prices_Customer.php trunk/SalesCategories.php trunk/SalesTypes.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSalesOrder.php trunk/SupplierAllocations.php trunk/includes/header.inc Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/BOMs.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -131,20 +131,20 @@ } else { $QuantityOnHand = number_format($myrow[10],$myrow[11]); } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> - <td>%s</td> <td>%s</td> <td>%s</td> + <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td class=number>%s</td> - <td><a href=\"%s&Select=%s&SelectedComponent=%s\">" . _('Edit') . "</a></td> - <td>".$DrillText."</a></td> - <td><a href=\"%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s\">" . _('Delete') . "</a></td> - </tr>", + <td><a href="%s&Select=%s&SelectedComponent=%s">' . _('Edit') . '</a></td> + <td>'.$DrillText.'</a></td> + <td><a href="%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s">' . _('Delete') . '</a></td> + </tr>', $Level1, $myrow[0], $myrow[1], @@ -789,7 +789,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . $title; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . - '<div class="page_help_text">'. _('Select a manufactured part') . " (" . _('or Assembly or Kit part') . ") " . + '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to maintain the bill of material for using the options below') . '<br /><font size=1>' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . ', ' . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. @@ -806,7 +806,7 @@ <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '"></div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (isset($_POST['Search']) and isset($result) AND !isset($SelectedParent)) { +if (isset($_POST['Search']) AND isset($result) AND !isset($SelectedParent)) { echo '<br /><table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Code') . '</th> Modified: trunk/Factors.php =================================================================== --- trunk/Factors.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/Factors.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,6 @@ <?php -//$PageSecurity = 5; +/* $Id$*/ include('includes/session.inc'); @@ -10,7 +10,7 @@ if (isset($_GET['FactorID'])){ $FactorID = strtoupper($_GET['FactorID']); - $_POST['amend']=True; + $_POST['Amend']=True; } elseif (isset($_POST['FactorID'])){ $FactorID = strtoupper($_POST['FactorID']); } else { @@ -19,7 +19,7 @@ if (isset($_POST['Create'])) { $FactorID = 0; - $_POST['New'] = "Yes"; + $_POST['New'] = 'Yes'; }; echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' @@ -31,22 +31,25 @@ //initialise no input errors assumed initially before we test $InputError = 0; -if (isset($_POST['submit']) or isset($_POST['update']) or isset($_POST['delete'])) { +if (isset($_POST['Submit']) OR isset($_POST['Update'])) { if (strlen($_POST['FactorName']) > 40 or strlen($_POST['FactorName']) == 0 or $_POST['FactorName'] == '') { $InputError = 1; prnMsg(_('The factoring company name must be entered and be forty characters or less long'),'error'); } - + if (strlen($_POST['Email'])>0 AND !IsEmailAddress($_POST['Email'])){ + prnMsg(_('The email address entered does not appear to be a valid email address format'),'error'); + $InputError = 1; + } // But if errors were found in the input if ($InputError>0) { - prnMsg(_('Validation failed') . _('no updates or deletes took place'),'warn'); + prnMsg(_('Validation failed no insert or update took place'),'warn'); include('includes/footer.inc'); exit; } - + /* If no input errors have been recieved */ - if ($InputError == 0 and isset($_POST['submit'])){ + if ($InputError == 0 and isset($_POST['Submit'])){ //And if its not a new part then update existing one $sql = "INSERT INTO factorcompanies (id, @@ -81,22 +84,7 @@ prnMsg(_('A new factoring company for') . ' ' . $_POST['FactorName'] . ' ' . _('has been added to the database'),'success'); - unset ($FactorID); - unset($_POST['FactorName']); - unset($_POST['Address1']); - unset($_POST['Address2']); - unset($_POST['Address3']); - unset($_POST['Address4']); - unset($_POST['Address5']); - unset($_POST['Address6']); - unset($_POST['ContactName']); - unset($_POST['Telephone']); - unset($_POST['Fax']); - unset($_POST['Email']); - - } - - if ($InputError == 0 and isset($_POST['update'])) { + }elseif ($InputError == 0 and isset($_POST['Update'])) { $sql = "UPDATE factorcompanies SET coyname='" . $_POST['FactorName'] . "', address1='" . $_POST['Address1'] . "', address2='" . $_POST['Address2'] . "', @@ -118,105 +106,50 @@ //If it is a new part then insert it } + unset ($FactorID); + unset($_POST['FactorName']); + unset($_POST['Address1']); + unset($_POST['Address2']); + unset($_POST['Address3']); + unset($_POST['Address4']); + unset($_POST['Address5']); + unset($_POST['Address6']); + unset($_POST['ContactName']); + unset($_POST['Telephone']); + unset($_POST['Fax']); + unset($_POST['Email']); +} +if (isset($_POST['Delete'])) { - /* If neither the Update or Insert buttons were pushed was it the delete button? */ + $CancelDelete = 0; - if (isset($_POST['delete'])) { + // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts - $CancelDelete = 0; + $sql= "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='".$FactorID."'"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_row($result); + if ($myrow[0] > 0) { + $CancelDelete = 1; + prnMsg(_('Cannot delete this factor because there are suppliers using them'),'warn'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); + } - // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts - - $sql= "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='".$FactorID."'"; + if ($CancelDelete == 0) { + $sql="DELETE FROM factorcompanies WHERE id='".$FactorID."'"; $result = DB_query($sql, $db); - $myrow = DB_fetch_row($result); - if ($myrow[0] > 0) { - $CancelDelete = 1; - prnMsg(_('Cannot delete this factor because there are suppliers using them'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); - } - - if ($CancelDelete == 0) { - $sql="DELETE FROM factorcompanies WHERE id='".$FactorID."'"; - $result = DB_query($sql, $db); - prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'),'success'); - echo '<br>'; - unset($_SESSION['FactorID']); - } //end if Delete factor - } + prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'),'success'); + echo '<br />'; + unset($_SESSION['FactorID']); + } //end if Delete factor unset($FactorID); } -/* So the page hasn't called itself with the input/update/delete/buttons */ -/* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the - option to create a new one*/ -if (empty($FactorID)) { +/* So the page hasn't called itself with the input/update/delete/buttons */ - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo "<input type='hidden' name='New' VALUE='No'>"; - echo '<table class=selection><tr>'; - echo '<th>' . _('ID') . '</th>'; - echo '<th>' . _('Company Name').'</th>'; - echo '<th>' . _('Address 1').'</th>'; - echo '<th>' . _('Address 2').'</th>'; - echo '<th>' . _('Address 3').'</th>'; - echo '<th>' . _('Address 4').'</th>'; - echo '<th>' . _('Address 5').'</th>'; - echo '<th>' . _('Address 6').'</th>'; - echo '<th>' . _('Contact').'</th>'; - echo '<th>' . _('Telephone').'</th>'; - echo '<th>' . _('Fax Number').'</th>'; - echo '<th>' . _('Email').'</th></tr>'; - $sql = "SELECT id, - coyname, - address1, - address2, - address3, - address4, - address5, - address6, - contact, - telephone, - fax, - email - FROM factorcompanies"; - $result=DB_query($sql, $db); - $j=1; - while ($myrow = DB_fetch_array($result)) { - if ($j==1) { - echo '<tr class="OddTableRows">'; - $j=0; - } else { - echo '<tr class="EvenTableRows">'; - $j++; - } - echo '<td>' . $myrow['id'] . '</td>'; - echo '<td>' . $myrow['coyname'].'</td>'; - echo '<td>' . $myrow['address1'].'</td>'; - echo '<td>' . $myrow['address2'].'</td>'; - echo '<td>' . $myrow['address3'].'</td>'; - echo '<td>' . $myrow['address4'].'</td>'; - echo '<td>' . $myrow['address5'].'</td>'; - echo '<td>' . $myrow['address6'].'</td>'; - echo '<td>' . $myrow['contact'].'</td>'; - echo '<td>' . $myrow['telephone'].'</td>'; - echo '<td>' . $myrow['fax'].'</td>'; - echo '<td>' . $myrow['email'].'</td>'; - echo '<td><a href="'.$rootpath . '/Factors.php?' . SID . '&FactorID='.$myrow['id'].'">'._('Edit').'</a></td></tr>'; - } - echo "</table><p><div class='centre'>"; - echo "<br><input tabindex=3 type='Submit' name='Create' value='" . _('Create New Factor') . "'>"; - echo '</div></form>'; - include('includes/footer.inc'); - exit; +if (isset($FactorID) and isset($_POST['Amend'])) { -} - -if (isset($FactorID) and isset($_POST['amend'])) { - $sql = "SELECT id, coyname, address1, @@ -261,37 +194,119 @@ $_POST['Email'] = ''; } -if (isset($_POST['amend']) or isset($_POST['Create'])) { +if (isset($_POST['Amend']) or isset($_POST['Create'])) { // its a new factor being added - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo "<input type=hidden name='FactorID' value='".$FactorID."'>"; + echo '<input type="hidden" name="FactorID" value="' . $FactorID .'">'; echo '<table class=selection>'; - echo "<input type=hidden name='New' value='Yes'>"; - echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' size=42 maxlength=40 value='".$_POST['FactorName']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' size=42 maxlength=40 value='".$_POST['Address1']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' size=42 maxlength=40 value='".$_POST['Address2']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' size=42 maxlength=40 value='".$_POST['Address3']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' size=42 maxlength=40 value='".$_POST['Address4']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' size=42 maxlength=40 value='".$_POST['Address5']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' size=42 maxlength=40 value='".$_POST['Address6']."'></td></tr>"; - echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' size=13 maxlength=25 value='".$_POST['ContactName']."'></td></tr>"; - echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' size=13 maxlength=25 value='".$_POST['Telephone']."'></td></tr>"; - echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE=0 size=13 maxlength=25 value='".$_POST['Fax']."'></td></tr>"; - echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' size=55 maxlength=55 value='".$_POST['Email']."'></td></tr>"; + echo '<input type="hidden" name="New" value="Yes">'; + echo '<tr><td>' . _('Factor company Name') . ':</td> + <td><input tabindex=1 type="text" name="FactorName" size=42 maxlength=40 value="' .$_POST['FactorName'].'"></td></tr>'; + echo '<tr><td>' . _('Address Line 1') . ':</td> + <td><input tabindex=2 type="text" name="Address1" size=42 maxlength=40 value="' . $_POST['Address1'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 2') . ':</td> + <td><input tabindex=3 type="text" name="Address2" size=42 maxlength=40 value="' . $_POST['Address2'] .'"></td></tr>'; + + echo '<tr><td>' . _('Address Line 3') . ':</td> + <td><input tabindex=4 type="text" name="Address3" size=42 maxlength=40 value="' .$_POST['Address3'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 4') . ':</td> + <td><input tabindex=5 type="text" name="Address4" size=42 maxlength=40 value="' . $_POST['Address4'].'"></td></tr>'; + echo '<tr><td>' . _('Address Line 5') . ':</td> + <td><input tabindex=6 type="text" name="Address5" size=42 maxlength=40 value="' . $_POST['Address5'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 6') . ':</td> + <td><input tabindex=7 type="text" name="Address6" size=42 maxlength=40 value="' .$_POST['Address6'] . '"></td></tr>'; + echo '<tr><td>' . _('Contact Name') . ':</td> + <td><input tabindex=8 type="text" name="ContactName" size=13 maxlength=25 value="' . $_POST['ContactName'] .'"></td></tr>'; + echo '<tr><td>' . _('Telephone') . ':</td> + <td><input tabindex=9 type="text" name="Telephone" size=13 maxlength=25 value="' .$_POST['Telephone'].'"></td></tr>'; + echo '<tr><td>' . _('Fax') . ':</td> + <td><input tabindex=10 type="text" name="Fax" value=0 size=13 maxlength=25 value="' . $_POST['Fax'] .'"></td></tr>'; + echo '<tr><td>' . _('Email') . ':</td> + <td><input tabindex=11 type="text" name="Email" size=55 maxlength=55 value="' . $_POST['Email'] . '"></td></tr>'; echo '</form>'; } if (isset($_POST['Create'])) { - echo "</table><p><div class='centre'><input tabindex=12 type='Submit' name='submit' VALUE='" . _('Insert New Factor') . "'></div>"; -} else if (isset($_POST['amend'])) { - echo "</table><p><div class='centre'><input tabindex=13 type='Submit' name='update' VALUE='" . _('Update Factor') . "'><p>"; + echo '</table><p><div class="centre"><input tabindex=12 type="submit" name="Submit" value="' . _('Insert New Factor') . '"></div>'; +} else if (isset($_POST['Amend'])) { + echo '</table> + <p><div class="centre"><input tabindex=13 type="submit" name="Update" value="' . _('Update Factor') . '"><p>'; prnMsg ( _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no suppliers are using this factor before the deletion is processed'), 'warn'); - echo "<p><input tabindex=14 type='Submit' name='delete' VALUE='" . _('Delete Factor') . "' onclick=\"return confirm('" . _('Are you sure you wish to delete this factoring company?') . "');\"></form></div>"; + echo '<p><input tabindex=14 type="submit" name="Delete" value="' . _('Delete Factor') . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this factoring company?') . '\');"></form></div>'; } +/* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the + option to create a new one*/ + +if (empty($FactorID) AND !isset($_POST['Create']) AND !isset($_POST['Amend'])) { + + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<input type="hidden" name="New" value="No">'; + echo '<table class=selection><tr> + <th>' . _('ID') . '</th> + <th>' . _('Company Name').'</th> + <th>' . _('Address 1').'</th> + <th>' . _('Address 2').'</th> + <th>' . _('Address 3').'</th> + <th>' . _('Address 4').'</th> + <th>' . _('Address 5').'</th> + <th>' . _('Address 6').'</th> + <th>' . _('Contact').'</th> + <th>' . _('Telephone').'</th> + <th>' . _('Fax Number').'</th> + <th>' . _('Email').'</th></tr>'; + $sql = "SELECT id, + coyname, + address1, + address2, + address3, + address4, + address5, + address6, + contact, + telephone, + fax, + email + FROM factorcompanies"; + $result=DB_query($sql, $db); + $j=1; + while ($myrow = DB_fetch_array($result)) { + if ($j==1) { + echo '<tr class="OddTableRows">'; + $j=0; + } else { + echo '<tr class="EvenTableRows">'; + $j++; + } + echo '<td>' . $myrow['id'] . '</td> + <td>' . $myrow['coyname'].'</td> + <td>' . $myrow['address1'].'</td> + <td>' . $myrow['address2'].'</td> + <td>' . $myrow['address3'].'</td> + <td>' . $myrow['address4'].'</td> + <td>' . $myrow['address5'].'</td> + <td>' . $myrow['address6'].'</td> + <td>' . $myrow['contact'].'</td> + <td>' . $myrow['telephone'].'</td> + <td>' . $myrow['fax'].'</td> + <td>' . $myrow['email'].'</td> + <td><a href="'.$rootpath . '/Factors.php?FactorID='.$myrow['id'].'">'._('Edit').'</a></td> + </tr>'; + } + echo '</table><p><div class="centre">'; + echo '<br /><input tabindex=3 type="submit" name="Create" value="' . _('Create New Factor') . '">'; + echo '</div></form>'; + include('includes/footer.inc'); + exit; + +} + + include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GLJournal.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -235,9 +235,8 @@ } echo '<table><tr> - <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal').":</td> - <td><input type='text' class='date' alt='".$_SESSION['DefaultDateFormat']."' name='JournalProcessDate' maxlength='10' size='11' value='" . - $_SESSION['JournalDetail']->JnlDate . "' /></td>"; + <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="JournalProcessDate" maxlength="10" size="11" value="' . $_SESSION['JournalDetail']->JnlDate . '" /></td>'; echo '<td>' . _('Type') . ':</td> <td><select name="JournalType">'; @@ -261,9 +260,9 @@ echo '<tr><th colspan="3"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Line Entry') . '</b></font></div></th></tr>'; /*now set up a GLCode field to select from avaialble GL accounts */ -echo '<tr><th>' . _('GL Tag') . '</th>'; -echo '<th>' . _('GL Account Code') . '</th>'; -echo '<th>' . _('Select GL Account') . '</th></tr>'; +echo '<tr><th>' . _('GL Tag') . '</th> + <th>' . _('GL Account Code') . '</th> + <th>' . _('Select GL Account') . '</th></tr>'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ @@ -321,19 +320,17 @@ $_POST['Debit'] = ''; } -echo '</tr><tr><th>' . _('Debit') . '</th><td><input type="text" class="number" name = "Debit" ' . - 'onChange="eitherOr(this, '.'Credit'.')"'. - ' Maxlength="12" size="10" value="' . $_POST['Debit'] . '" /></td>'; -echo '</tr><tr><th>' . _('Credit') . '</th><td><input type="text" class="number" Name = "Credit" ' . - 'onChange="eitherOr(this, '.'Debit'.')"'. - ' Maxlength="12" size="10" value="' . $_POST['Credit'] . '" /></td>'; +echo '</tr><tr><th>' . _('Debit') . '</th> + <td><input type="text" class="number" name = "Debit" onChange="eitherOr(this, '.'Credit'.')" maxlength="12" size="10" value="' . $_POST['Debit'] . '" /></td>'; +echo '</tr><tr><th>' . _('Credit') . '</th> + <td><input type="text" class="number" Name = "Credit" onChange="eitherOr(this, '.'Debit'.')" maxlength="12" size="10" value="' . $_POST['Credit'] . '" /></td>'; echo '</tr><tr><td></td><td></td><th>'. _('Narrative'). '</th>'; echo '</tr><tr><th></th><th>' . _('GL Narrative') . '</th>'; echo '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; echo '</tr></table><br />'; /*Close the main table */ -echo '<div class="centre"><input type="submi2t" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; +echo '<div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; echo '<table class="selection" width="85%">'; @@ -369,8 +366,8 @@ } else { $TagDescription=$myrow[0]; } - echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td>'; - echo '<td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; + echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td> + <td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { echo '<td class="number">' . number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; $DebitTotal=$DebitTotal+$JournalItem->Amount; @@ -402,7 +399,7 @@ echo '</table>'; if (ABS($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ - echo "<br /><br /><div class='centre'><input type='submit' name='CommitBatch' value='"._('Accept and Process Journal')."' /></div>"; + echo '<br /><br /><div class="centre"><input type="submit" name="CommitBatch" value="' ._('Accept and Process Journal').'" /></div>'; } elseif(count($_SESSION['JournalDetail']->GLEntries)>0) { echo '<br /><br />'; prnMsg(_('The journal must balance ie debits equal to credits before it can be processed'),'warn'); Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GLTags.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -80,7 +80,7 @@ echo '<tr><td>' . $myrow['tagref'].'</td> <td>' . $myrow['tagdescription'].'</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=edit">' . _('Edit') . '</a></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete">' . _('Delete') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete" onclick="return confirm(\'' . _('Are you sure you wish to delete this GL tag?') . '\');">' . _('Delete') . '</a></td> </tr>'; } Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GoodsReceived.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -79,10 +79,10 @@ echo '<table cellpadding=2 class=selection> <tr><th colspan="2"></th> - <th align="centre" colspan="3"><b>' . _('Supplier Units') . '</b></th> - <th></th> - <th align="centre" colspan="5"><b>' . _('Our Receiving Units') . '</b></th> - </tr> + <th align="centre" colspan="3"><b>' . _('Supplier Units') . '</b></th> + <th></th> + <th align="centre" colspan="5"><b>' . _('Our Receiving Units') . '</b></th> + </tr> <tr><th>' . _('Item Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('Quantity') . '<br />' . _('Ordered') . '</th> Modified: trunk/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/MRPDemands.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,7 @@ <?php -/* $Revision: 1.5 $ */ + /* $Id$*/ + // Add, Edit, Delete, and List MRP demand records. Table is mrpdemands. // Have separate functions for each routine. Use pass-by-reference - (&$db,&$StockID) - // to pass values of $db and $StockID to functions. - when just used $db as variable, Modified: trunk/OffersReceived.php =================================================================== --- trunk/OffersReceived.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/OffersReceived.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -87,19 +87,20 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Supplier Offers') . '" alt="" />' . ' ' . _('Supplier Offers') . '</p>'; - echo '<table class=selection>'; - echo '<tr><th>'._('Offer ID').'</th>'; - echo '<th>'._('Supplier').'</th>'; - echo '<th>'._('Stock Item').'</th>'; - echo '<th>'._('Quantity').'</th>'; - echo '<th>'._('Units').'</th>'; - echo '<th>'._('Price').'</th>'; - echo '<th>'._('Total').'</th>'; - echo '<th>'._('Currency').'</th>'; - echo '<th>'._('Offer Expires').'</th>'; - echo '<th>'._('Accept').'</th>'; - echo '<th>'._('Reject').'</th>'; - echo '<th>'._('Defer').'</th></tr>'; + echo '<table class=selection> + <tr> + <th>'._('Offer ID').'</th> + <th>'._('Supplier').'</th> + <th>'._('Stock Item').'</th> + <th>'._('Quantity').'</th> + <th>'._('Units').'</th> + <th>'._('Price').'</th> + <th>'._('Total').'</th> + <th>'._('Currency').'</th> + <th>'._('Offer Expires').'</th> + <th>'._('Accept').'</th> + <th>'._('Reject').'</th> + <th>'._('Defer').'</th></tr>'; $k=0; while ($myrow=DB_fetch_array($result)) { @@ -110,22 +111,22 @@ echo '<tr class="OddTableRows">'; $k++; } - echo '<td>'.$myrow['offerid'].'</td>'; - echo '<td>'.$myrow['suppname'].'</td>'; - echo '<td>'.$myrow['description'].'</td>'; - echo '<td class=number>'.number_format($myrow['quantity'],$myrow['decimalplaces']).'</td>'; - echo '<td>'.$myrow['uom'].'</td>'; - echo '<td class=number>'.number_format($myrow['price'],2).'</td>'; - echo '<td class=number>'.number_format($myrow['price']*$myrow['quantity'],2).'</td>'; - echo '<td>'.$myrow['currcode'].'</td>'; - echo '<td>'.$myrow['expirydate'].'</td>'; - echo '<td><input type="radio" name="action'.$myrow['offerid'].'" value="1"></td>'; - echo '<td><input type="radio" name="action'.$myrow['offerid'].'" value="2"></td>'; - echo '<td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3"></td>'; - echo '<td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'"></td>'; - echo '</tr>'; + echo '<td>'.$myrow['offerid'].'</td> + <td>'.$myrow['suppname'].'</td> + <td>'.$myrow['description'].'</td> + <td class=number>'.number_format($myrow['quantity'],$myrow['decimalplaces']).'</td> + <td>'.$myrow['uom'].'</td> + <td class=number>'.number_format($myrow['price'],2).'</td> + <td class=number>'.number_format($myrow['price']*$myrow['quantity'],2).'</td> + <td>'.$myrow['currcode'].'</td> + <td>'.$myrow['expirydate'].'</td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="1"></td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="2"></td> + <td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3"></td> + <td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'"></td> + </tr>'; } - echo '<tr><td colspan=12><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div></td></tr>'; + echo '<tr><td colspan=12><div class="centre"><input type="submit" name="submit" value=' . _('Enter Information') . '></div></td></tr>'; echo '</form></table>'; } else if(isset($_POST['submit']) and isset($_POST['supplierid'])) { include ('includes/htmlMimeMail.php'); @@ -203,7 +204,6 @@ unitprice, actprice, quantityord, - itemno, suppliersunit) VALUES ( '".$OrderNo."', @@ -213,7 +213,6 @@ '".$myrow['price']."', '".$myrow['price']."', '".$myrow['quantity']."', - '".$myrow['stockid']."', '".$myrow['uom']."')"; $result=DB_query($sql, $db); $sql="DELETE FROM offers WHERE offerid='".$AcceptID."'"; @@ -226,7 +225,7 @@ $result = $mail->send(array($Email), 'smtp'); prnMsg(_('The accepted offers from').' '.$SupplierName.' '._('have been converted to purchase orders and an email sent to') .' '.$Email."\n"._('Please review the order contents').' '.'<a href="'.$rootpath . - "/PO_Header.php?ModifyOrderNumber=" . $OrderNo.'">'._('here').'</a>"', 'success'); + '/PO_Header.php?ModifyOrderNumber=' . $OrderNo.'">'._('here').'</a>', 'success'); } if (sizeOf($rejects)>0){ $MailText=_('This email has been automatically generated by the webERP installation at').' '. @@ -259,4 +258,4 @@ } include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_AuthorisationLevels.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -67,8 +67,8 @@ cancreate='".$CanCreate."', offhold='".$OffHold."', authlevel='".$_POST['AuthLevel']."' - WHERE userid='".$_POST['UserID']."' - AND currabrev='".$_POST['CurrCode']."'"; + WHERE userid='".$_POST['UserID']."' + AND currabrev='".$_POST['CurrCode']."'"; $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); @@ -88,8 +88,8 @@ offhold, authlevel FROM purchorderauth - WHERE userid='".$_GET['UserID']."' - AND currabrev='".$_GET['Currency']."'"; + WHERE userid='".$_GET['UserID']."' + AND currabrev='".$_GET['Currency']."'"; $ErrMsg = _('The authentication details cannot be retrieved because'); $result=DB_query($sql,$db,$ErrMsg); $myrow=DB_fetch_array($result); @@ -100,7 +100,7 @@ $AuthLevel=$myrow['authlevel']; } -$sql='SELECT purchorderauth.userid, +$sql="SELECT purchorderauth.userid, www_users.realname, currencies.currabrev, currencies.currency, @@ -110,7 +110,7 @@ FROM purchorderauth INNER JOIN www_users ON purchorderauth.userid=www_users.userid INNER JOIN currencies - ON purchorderauth.currabrev=currencies.currabrev'; + ON purchorderauth.currabrev=currencies.currabrev"; $ErrMsg = _('The authentication details cannot be retrieved because'); $Result=DB_query($sql,$db,$ErrMsg); @@ -134,17 +134,18 @@ } else { $OffHold=_('No'); } - echo '<tr><td>' . $myrow['userid'] . '</td> - <td>' . $myrow['realname'] . '</td> - <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . -'&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . -'&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> - </tr>'; + echo '<tr> + <td>' . $myrow['userid'] . '</td> + <td>' . $myrow['realname'] . '</td> + <td>' . $myrow['currency'] . '</td> + <td>' . $CanCreate . '</td> + <td>' . $OffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . + '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . + '&Currency='.$myrow['currabrev'].'" onclick="return confirm(\'' . _('Are you sure you wish to delete this authorisation level?') . '\');">'._('Delete').'</td> + </tr>'; } echo '</table><br><br>'; @@ -158,7 +159,7 @@ echo '<input type=hidden name=UserID value="'.$UserID.'"'; } else { echo '<tr><td>'._('User ID').'</td><td><select name=UserID>'; - $usersql='SELECT userid FROM www_users'; + $usersql="SELECT userid FROM www_users"; $userresult=DB_query($usersql,$db); while ($myrow=DB_fetch_array($userresult)) { if ($myrow['userid']==$UserID) { @@ -174,12 +175,14 @@ $CurrencySQL="SELECT currency FROM currencies WHERE currabrev='".$Currency."'"; $CurrencyResult=DB_query($CurrencySQL,$db); $myrow=DB_fetch_array($CurrencyResult); - echo '<tr><td>'._('Currency').'</td> - <td>' . $myrow['currency'] . '</td></tr>'; + echo '<tr> + <td>'._('Currency').'</td> + <td>' . $myrow['currency'] . '</td> + </tr>'; echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; - $currencysql='SELECT currabrev,currency FROM currencies'; + $currencysql="SELECT currabrev,currency FROM currencies"; $currencyresult=DB_query($currencysql,$db); while ($myrow=DB_fetch_array($currencyresult)) { if ($myrow['currabrev']==$Currency) { Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_AuthoriseMyOrders.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -//$PageSecurity = 4; + include('includes/session.inc'); $title = _('Authorise Purchase Orders'); @@ -11,22 +11,22 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; -$emailsql="SELECT email FROM www_users WHERE userid='".$_SESSION['UserID']."'"; -$emailresult=DB_query($emailsql, $db); -$emailrow=DB_fetch_array($emailresult); +$EmailSQL="SELECT email FROM www_users WHERE userid='".$_SESSION['UserID']."'"; +$EmailResult=DB_query($EmailSQL, $db); +$EmailRow=DB_fetch_array($EmailResult); -if (isset($_POST['updateall'])) { +if (isset($_POST['UpdateAll'])) { foreach ($_POST as $key => $value) { if (substr($key,0,6)=='status') { - $orderno=substr($key,6); - $status=$_POST['status'.$orderno]; - $comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:'. - $emailrow['email'].'">'.$_SESSION['UserID'].'</a><br>'.$_POST['comment']; + $OrderNo=substr($key,6); + $Status=$_POST['status'.$OrderNo]; + $Comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:' . $EmailRow['email'].'">'.$_SESSION['UserID'].'</a> + <br />' . $_POST['comment']; $sql="UPDATE purchorders - SET status='".$status."', - stat_comment='".$comment."', - allowprint=1 - WHERE orderno='".$orderno."'"; + SET status='".$Status."', + stat_comment='".$Comment."', + allowprint=1 + WHERE orderno='".$OrderNo."'"; $result=DB_query($sql, $db); } } @@ -38,91 +38,98 @@ suppliers.suppname, suppliers.currcode, www_users.realname, - www_users.email - FROM purchorders - LEFT JOIN suppliers + www_users.email, + currencies.decimalplaces + FROM purchorders INNER JOIN suppliers ON suppliers.supplierid=purchorders.supplierno - LEFT JOIN www_users + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + INNER JOIN www_users ON www_users.userid=purchorders.initiator WHERE status='Pending'"; $result=DB_query($sql, $db); echo '<form method=post action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class=selection><tr>'; +echo '<table class="selection">'; /* Create the table for the purchase order header */ -echo '<th>'._('Order Number').'</th>'; -echo '<th>'._('Supplier').'</th>'; -echo '<th>'._('Date Ordered').'</th>'; -echo '<th>'._('Initiator').'</th>'; -echo '<th>'._('Delivery Date').'</th>'; -echo '<th>'._('Status').'</th>'; -echo '</tr>'; +echo '<tr> + <th>'._('Order Number').'</th> + <th>'._('Supplier').'</th> + <th>'._('Date Ordered').'</th> + <th>'._('Initiator').'</th> + <th>'._('Delivery Date').'</th> + <th>'._('Status').'</th> + </tr>'; while ($myrow=DB_fetch_array($result)) { - $authsql="SELECT authlevel FROM purchorderauth + $AuthSQL="SELECT authlevel FROM purchorderauth WHERE userid='".$_SESSION['UserID']."' AND currabrev='".$myrow['currcode']."'"; - $authresult=DB_query($authsql, $db); - $myauthrow=DB_fetch_array($authresult); - $authlevel=$myauthrow['authlevel']; + $AuthResult=DB_query($AuthSQL, $db); + $myauthrow=DB_fetch_array($AuthResult); + $AuthLevel=$myauthrow['authlevel']; - $ordervaluesql="SELECT sum(unitprice*quantityord) as ordervalue + $OrderValueSQL="SELECT sum(unitprice*quantityord) as ordervalue FROM purchorderdetails WHERE orderno='".$myrow['orderno'] . "'"; - $ordervalueresult=DB_query($ordervaluesql, $db); - $myordervaluerow=DB_fetch_array($ordervalueresult); - $ordervalue=$myordervaluerow['ordervalue']; + $OrderValueResult=DB_query($OrderValueSQL, $db); + $MyOrderValueRow=DB_fetch_array($OrderValueResult); + $OrderValue=$MyOrderValueRow['ordervalue']; - if ($authlevel>=$ordervalue) { - echo '<tr>'; - echo '<td>'.$myrow['orderno'].'</td>'; - echo '<td>'.$myrow['suppname'].'</td>'; - echo '<td>'.ConvertSQLDate($myrow['orddate']).'</td>'; - echo '<td><a href="mailto:'.$myrow['email'].'">'.$myrow['realname'].'</td>'; - echo '<td>'.ConvertSQLDate($myrow['deliverydate']).'</td>'; - echo '<td><select name=status'.$myrow['orderno'].'>'; - echo '<option selected value="Pending">'._('Pending').'</option>'; - echo '<option value="Authorised">'._('Authorised').'</option>'; - echo '<option value="Rejected">'._('Rejected').'</option>'; - echo '<option value="Cancelled">'._('Cancelled').'</option>'; - echo '</select></td>'; - echo '</tr>'; + if ($AuthLevel>=$OrderValue) { + echo '<tr> + <td>'.$myrow['orderno'].'</td> + <td>'.$myrow['suppname'].'</td> + <td>'.ConvertSQLDate($myrow['orddate']).'</td> + <td><a href="mailto:'.$myrow['email'].'">'.$myrow['realname'].'</td> + <td>'.ConvertSQLDate($myrow['deliverydate']).'</td> + <td><select name=status'.$myrow['orderno'].'> + <option selected value="Pending">'._('Pending').'</option> + <option value="Authorised">'._('Authorised').'</option> + <option value="Rejected">'._('Rejected').'</option> + <option value="Cancelled">'._('Cancelled').'</option> + </select></td> + </tr>'; echo "<input type='hidden' name='comment' value='".$myrow['stat_comment']."'>"; - $linesql="SELECT purchorderdetails.*, + $LineSQL="SELECT purchorderdetails.*, stockmaster.description FROM purchorderdetails LEFT JOIN stockmaster ON stockmaster.stockid=purchorderdetails.itemcode WHERE orderno='".$myrow['orderno'] . "'"; - $lineresult=DB_query($linesql, $db); + $LineResult=DB_query($LineSQL, $db); - echo '<tr><td></td><td colspan=5 align=left><table class=selection align=left>'; - echo '<th>'._('Product').'</th>'; - echo '<th>'._('Quantity Ordered').'</th>'; - echo '<th>'._('Currency').'</th>'; - echo '<th>'._('Price').'</th>'; - echo '<th>'._('Line Total').'</th>'; - echo '</tr>'; + echo '<tr> + <td></td> + <td colspan="5" align="left"> + <table class="selection" align="left"> + <tr> + <th>'._('Product').'</th> + <th>'._('Quantity Ordered').'</th> + <th>'._('Currency').'</th> + <th>'._('Price').'</th> + <th>'._('Line Total').'</th> + </tr>'; - while ($linerow=DB_fetch_array($lineresult)) { - echo '<tr>'; - echo '<td>'.$linerow['description'].'</td>'; - echo '<td class="number">'.number_format($linerow['quantityord'],2).'</td>'; - echo '<td>'.$myrow['currcode'].'</td>'; - echo '<td class="number">'.number_format($linerow['unitprice'],2).'</td>'; - echo '<td class="number">'.number_format($linerow['unitprice']*$linerow['quantityord'],2).'</td>'; - echo '</tr>'; + while ($linerow=DB_fetch_array($LineResult)) { + echo '<tr> + <td>'.$linerow['description'].'</td> + <td class="number">'.number_format($linerow['quantityord'],2).'</td> + <td>'.$myrow['currcode'].'</td> + <td class="number">'.number_format($linerow['unitprice'],$myrow['decimalplaces']).'</td> + <td class="number">'.number_format($linerow['unitprice']*$linerow['quantityord'],$myrow['decimalplaces']).'</td> + </tr>'; } // end while order line detail echo '</table></td></tr>'; } } //end while header loop echo '</table>'; -echo '<br><div class="centre"><input type="submit" name="updateall" value="' . _('Update'). '"></form>'; +echo '<br><div class="centre"><input type="submit" name="UpdateAll" value="' . _('Update'). '"></form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_SelectPurchOrder.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -//$PageSecurity = 2; + include ('includes/session.inc'); $title = _('Search Purchase Orders'); include ('includes/header.inc'); @@ -110,14 +110,14 @@ while ($myrow = DB_fetch_array($resultStkLocs)) { if (isset($_POST['StockLocation'])) { if ($myrow['loccode'] == $_POST['StockLocation']) { - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode'] == $_SESSION['UserStockLocation']) { - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select> ' . _('Order Status:') .' <select name="Status">'; @@ -160,9 +160,9 @@ echo '<tr><td><font size=1>' . _('Select a stock category') . ':</font><select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $myrow1['categoryid'] == $_POST['StockCat']) { - echo "<option selected value='" . $myrow1['categoryid'] . "'>" . $myrow1['categorydescription']; + echo '<option selected value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } else { - echo "<option value='" . $myrow1['categoryid'] . "'>" . $myrow1['categorydescription']; + echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } } echo '</select><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td>'; @@ -191,12 +191,12 @@ echo '<tr bgcolor="#EEEEEE">'; $k = 1; } - echo "<td><input type=submit name='SelectedStockItem' value='" . $myrow['stockid'] . "'</td> - <td>" . $myrow['description'] . "</td> - <td class=number>" . $myrow['qoh'] . "</td> - <td class=number>" . $myrow['qord'] . "</td> - <td>" . $myrow['units'] . "</td> - </tr>"; + echo '<td><input type="submit" name="SelectedStockItem" value="' . $myrow['stockid'] . '"</td> + <td>' . $myrow['description'] . '</td> + <td class=number>' . $myrow['qoh'] . '</td> + <td class=number>' . $myrow['qord'] . '</td> + <td>' . $myrow['units'] . '</td> + </tr>'; $j++; if ($j == 12) { $j = 1; @@ -234,14 +234,25 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.orderno='" . $OrderNumber . "' - GROUP BY purchorders.orderno"; + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.orderno='" . $OrderNumber . "' + GROUP BY purchorders.orderno, + suppliers.suppname, + purchorders.orddate, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + purchorders.status, + suppliers.currcode, + currencies.decimalplaces"; } else { /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ if (empty($_POST['StockLocation'])) { @@ -257,13 +268,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorderdetails.itemcode='" . $SelectedStockItem . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorderdetails.itemcode='" . $SelectedStockItem . "' AND purchorders.supplierno='" . $SelectedSupplier . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " @@ -273,7 +287,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } else { $SQL = "SELECT purchorders.orderno, suppliers.suppname, @@ -283,13 +298,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.supplierno='" . $SelectedSupplier . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.supplierno='" . $SelectedSupplier . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, @@ -298,7 +316,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } } else { //no supplier selected if (isset($SelectedStockItem)) { @@ -310,13 +329,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorderdetails.itemcode='" . $SelectedStockItem . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorderdetails.itemcode='" . $SelectedStockItem . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, @@ -325,7 +347,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } else { $SQL = "SELECT purchorders.orderno, suppliers.suppname, @@ -335,13 +358,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, sum(purchorderdetails.unitprice*purchorderdetails.quantityord) as ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, suppliers.suppname, @@ -349,7 +375,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } } //end selected supplier @@ -360,15 +387,16 @@ if (DB_num_rows($PurchOrdersResult) > 0) { /*show a table of the orders returned by the SQL */ echo '<table cellpadding=2 colspan=7 width=90% class=selection>'; - $TableHeader = '<tr><th>' . _('View') . '</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Requisition') . '</th> - <th>' . _('Order Date') . '</th> - <th>' . _('Initiator') . '</th> - <th>' . _('Order Total') . '</th> - <th>' . _('Status') . '</th> - </tr>'; + $TableHeader = '<tr> + <th>' . _('View') . '</th> + <th>' . _('Supplier') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Requisition') . '</th> + <th>' . _('Order Date') . '</th> + <th>' . _('Initiator') . '</th> + <th>' . _('Order Total') . '</th> + <th>' . _('Status') . '</th> + </tr>'; echo $TableHeader; $j = 1; $k = 0; //row colour counter @@ -380,9 +408,9 @@ echo '<tr bgcolor="#EEEEEE">'; $k++; } - $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?' . SID . 'OrderNo=' . $myrow['orderno']; + $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?OrderNo=' . $myrow['orderno']; $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); - $FormatedOrderValue = number_format($myrow['ordervalue'], 2); + $FormatedOrderValue = number_format($myrow['ordervalue'], $myrow['decimalplaces']); /* View Supplier Currency Requisition Order Date Initiator Order Total ModifyPage, $myrow["orderno"], $myrow["suppname"], $myrow["currcode"], $myrow["requisitionno"] $FormatedOrderDate, $myrow["initiator"] $FormatedOrderValue Order Status*/ echo '<td><a href="' . $ViewPurchOrder . '">' . $myrow['orderno'] . '</a></td> Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/Payments.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -231,10 +231,10 @@ } /*Make an array of the defined bank accounts */ - $SQL = 'SELECT bankaccounts.accountcode + $SQL = "SELECT bankaccounts.accountcode FROM bankaccounts, chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + WHERE bankaccounts.accountcode=chartmaster.accountcode"; $result = DB_query($SQL,$db); $BankAccounts = array(); $i=0; @@ -270,8 +270,8 @@ } else { //Start a transaction to do the whole lot inside - $SQL = 'BEGIN'; - $result = DB_query($SQL,$db); + + $result = DB_Txn_Begin($db); if ($_SESSION['PaymentDetail']->SupplierID=='') { @@ -643,7 +643,7 @@ } else if ($_POST['GLCode'] == '') { prnMsg( _('No General Ledger code has been chosen') . ' - ' . _('so this GL analysis item could not be added'),'warn'); } else { - $SQL = "select accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; + $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); $_SESSION['PaymentDetail']->add_to_glanalysis($_POST['GLAmount'], @@ -702,7 +702,7 @@ } -echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/PcAssignCashToTab.php =================================================================== --- trunk/PcAssignCashToTab.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PcAssignCashToTab.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -49,8 +49,8 @@ } $sqlLimit = "SELECT tablimit - FROM pctabs - WHERE tabcode='" . $SelectedTabs . "'"; + FROM pctabs + WHERE tabcode='" . $SelectedTabs . "'"; $ResultLimit = DB_query($sqlLimit,$db); $Limit=DB_fetch_array($ResultLimit); @@ -63,10 +63,10 @@ $sql = "UPDATE pcashdetails SET date = '".FormatDateForSQL($_POST['Date'])."', - amount = '" . $_POST['Amount'] . "', - authorized = '0000-00-00', - notes = '" . $_POST['Notes'] . "', - receipt = '" . $_POST['Receipt'] . "' + amount = '" . $_POST['Amount'] . "', + authorized = '0000-00-00', + notes = '" . $_POST['Notes'] . "', + receipt = '" . $_POST['Receipt'] . "' WHERE counterindex = '" . $SelectedIndex . "'"; $msg = _('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been updated'); @@ -163,7 +163,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title. '</p>'; } - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Details Of Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Details Of Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div>'; if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ @@ -263,7 +263,7 @@ } echo '<tr><td colspan="2" style="text-align:right"><b>' . _('Current balance') . ':</b></td> - <td>' . number_format($Amount['0'],2) . '</td></tr>'; + <td>' . number_format($Amount['0'],2) . '</td></tr>'; echo '</table>'; @@ -277,7 +277,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table if (isset($_GET['SelectedIndex'])) { echo '<tr><th colspan="2"><font color=blue size=3>'._('Update Cash Assignment').'</font></th></tr>'; } else { Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PcClaimExpensesFromTab.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -43,7 +43,7 @@ if ($_POST['amount']==0) { $InputError = 1; - prnMsg('<br>' . _('The Amount must be greater than 0'),'error'); + prnMsg( _('The Amount must be greater than 0'),'error'); $Errors[$i] = 'TabCode'; $i++; } @@ -83,7 +83,7 @@ '" . $_POST['Receipt'] . "' )"; - $msg = _('The Expense Claim on Tab') . ' ' . $_POST["SelectedTabs"] . ' ' . _('has been created'); + $msg = _('The Expense Claim on Tab') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); } if ( $InputError !=1) { @@ -154,7 +154,7 @@ //end of ifs and buts! if (isset($_POST['process'])OR isset($SelectedTabs)) { - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; /* RICARD */ if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; @@ -186,13 +186,13 @@ echo '<br><table border=1>'; echo '<tr> - <th>' . _('Date Of Expense') . '</th> - <th>' . _('Expense Description') . '</th> - <th>' . _('Amount') . '</th> - <th>' . _('Authorized') . '</th> - <th>' . _('Notes') . '</th> - <th>' . _('Receipt') . '</th> - </tr>'; + <th>' . _('Date Of Expense') . '</th> + <th>' . _('Expense Description') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Authorized') . '</th> + <th>' . _('Notes') . '</th> + <th>' . _('Receipt') . '</th> + </tr>'; $k=0; //row colour counter @@ -216,17 +216,17 @@ $Description['0']='ASSIGNCASH'; } - if (($myrow['5'] == "0000-00-00") and ($Description['0'] != 'ASSIGNCASH')){ + if (($myrow['5'] == '0000-00-00') and ($Description['0'] != 'ASSIGNCASH')){ // only movements NOT authorized can be modified or deleted - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href='%sSelectedIndex=%s&SelectedTabs=$SelectedTabs&Days=$Days&edit=yes'>" . _('Edit') . "</td> - <td><a href='%sSelectedIndex=%s&SelectedTabs=$SelectedTabs&Days=$Days&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this code and the expense it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedIndex=%s&SelectedTabs=' . $SelectedTabs . '&Days=' . $Days . '&edit=yes">' . _('Edit') . '</td> + <td><a href="%sSelectedIndex=%s&SelectedTabs=' . $SelectedTabs . '&Days=' . $Days . '&delete=yes" onclick=\'return confirm("' . _('Are you sure you wish to delete this code and the expenses it may have set up?') . '");\'>' . _('Delete') . '</td> + </tr>', ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), @@ -236,13 +236,13 @@ $_SERVER['PHP_SELF'] . '?', $myrow['0'], $_SERVER['PHP_SELF'] . '?', $myrow['0']); } else { - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - </tr>", + </tr>', ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), @@ -325,7 +325,7 @@ if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['codeexpense'] . '">' . $myrow['codeexpense'] . ' - ' . $myrow['description'] . '</option>'; @@ -357,7 +357,7 @@ echo '<input type="hidden" name="Days" value="' .$Days. '">'; echo '</table>'; // close table in first column echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><in... [truncated message content] |
From: <dai...@us...> - 2011-05-13 10:50:51
|
Revision: 4565 http://web-erp.svn.sourceforge.net/web-erp/?rev=4565&view=rev Author: daintree Date: 2011-05-13 10:50:42 +0000 (Fri, 13 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/BOMs.php trunk/Factors.php trunk/GLJournal.php trunk/GLTags.php trunk/GoodsReceived.php trunk/MRPDemands.php trunk/OffersReceived.php trunk/PO_AuthorisationLevels.php trunk/PO_AuthoriseMyOrders.php trunk/PO_SelectPurchOrder.php trunk/Payments.php trunk/PcAssignCashToTab.php trunk/PcClaimExpensesFromTab.php trunk/PcTabs.php trunk/Prices.php trunk/Prices_Customer.php trunk/SalesCategories.php trunk/SalesTypes.php trunk/SelectProduct.php trunk/SelectRecurringSalesOrder.php trunk/SelectSalesOrder.php trunk/SupplierAllocations.php trunk/includes/header.inc Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/BOMs.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -131,20 +131,20 @@ } else { $QuantityOnHand = number_format($myrow[10],$myrow[11]); } - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> - <td>%s</td> <td>%s</td> <td>%s</td> + <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> <td class=number>%s</td> - <td><a href=\"%s&Select=%s&SelectedComponent=%s\">" . _('Edit') . "</a></td> - <td>".$DrillText."</a></td> - <td><a href=\"%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s\">" . _('Delete') . "</a></td> - </tr>", + <td><a href="%s&Select=%s&SelectedComponent=%s">' . _('Edit') . '</a></td> + <td>'.$DrillText.'</a></td> + <td><a href="%s&Select=%s&SelectedComponent=%s&delete=1&ReSelect=%s">' . _('Delete') . '</a></td> + </tr>', $Level1, $myrow[0], $myrow[1], @@ -789,7 +789,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' ' . $title; echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">' . - '<div class="page_help_text">'. _('Select a manufactured part') . " (" . _('or Assembly or Kit part') . ") " . + '<div class="page_help_text">'. _('Select a manufactured part') . ' (' . _('or Assembly or Kit part') . ') ' . _('to maintain the bill of material for using the options below') . '<br /><font size=1>' . _('Parts must be defined in the stock item entry') . '/' . _('modification screen as manufactured') . ', ' . _('kits or assemblies to be available for construction of a bill of material') .'</div>'. @@ -806,7 +806,7 @@ <br /><div class="centre"><input tabindex="3" type="submit" name="Search" value="' . _('Search Now') . '"></div>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (isset($_POST['Search']) and isset($result) AND !isset($SelectedParent)) { +if (isset($_POST['Search']) AND isset($result) AND !isset($SelectedParent)) { echo '<br /><table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Code') . '</th> Modified: trunk/Factors.php =================================================================== --- trunk/Factors.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/Factors.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,6 @@ <?php -//$PageSecurity = 5; +/* $Id$*/ include('includes/session.inc'); @@ -10,7 +10,7 @@ if (isset($_GET['FactorID'])){ $FactorID = strtoupper($_GET['FactorID']); - $_POST['amend']=True; + $_POST['Amend']=True; } elseif (isset($_POST['FactorID'])){ $FactorID = strtoupper($_POST['FactorID']); } else { @@ -19,7 +19,7 @@ if (isset($_POST['Create'])) { $FactorID = 0; - $_POST['New'] = "Yes"; + $_POST['New'] = 'Yes'; }; echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' @@ -31,22 +31,25 @@ //initialise no input errors assumed initially before we test $InputError = 0; -if (isset($_POST['submit']) or isset($_POST['update']) or isset($_POST['delete'])) { +if (isset($_POST['Submit']) OR isset($_POST['Update'])) { if (strlen($_POST['FactorName']) > 40 or strlen($_POST['FactorName']) == 0 or $_POST['FactorName'] == '') { $InputError = 1; prnMsg(_('The factoring company name must be entered and be forty characters or less long'),'error'); } - + if (strlen($_POST['Email'])>0 AND !IsEmailAddress($_POST['Email'])){ + prnMsg(_('The email address entered does not appear to be a valid email address format'),'error'); + $InputError = 1; + } // But if errors were found in the input if ($InputError>0) { - prnMsg(_('Validation failed') . _('no updates or deletes took place'),'warn'); + prnMsg(_('Validation failed no insert or update took place'),'warn'); include('includes/footer.inc'); exit; } - + /* If no input errors have been recieved */ - if ($InputError == 0 and isset($_POST['submit'])){ + if ($InputError == 0 and isset($_POST['Submit'])){ //And if its not a new part then update existing one $sql = "INSERT INTO factorcompanies (id, @@ -81,22 +84,7 @@ prnMsg(_('A new factoring company for') . ' ' . $_POST['FactorName'] . ' ' . _('has been added to the database'),'success'); - unset ($FactorID); - unset($_POST['FactorName']); - unset($_POST['Address1']); - unset($_POST['Address2']); - unset($_POST['Address3']); - unset($_POST['Address4']); - unset($_POST['Address5']); - unset($_POST['Address6']); - unset($_POST['ContactName']); - unset($_POST['Telephone']); - unset($_POST['Fax']); - unset($_POST['Email']); - - } - - if ($InputError == 0 and isset($_POST['update'])) { + }elseif ($InputError == 0 and isset($_POST['Update'])) { $sql = "UPDATE factorcompanies SET coyname='" . $_POST['FactorName'] . "', address1='" . $_POST['Address1'] . "', address2='" . $_POST['Address2'] . "', @@ -118,105 +106,50 @@ //If it is a new part then insert it } + unset ($FactorID); + unset($_POST['FactorName']); + unset($_POST['Address1']); + unset($_POST['Address2']); + unset($_POST['Address3']); + unset($_POST['Address4']); + unset($_POST['Address5']); + unset($_POST['Address6']); + unset($_POST['ContactName']); + unset($_POST['Telephone']); + unset($_POST['Fax']); + unset($_POST['Email']); +} +if (isset($_POST['Delete'])) { - /* If neither the Update or Insert buttons were pushed was it the delete button? */ + $CancelDelete = 0; - if (isset($_POST['delete'])) { + // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts - $CancelDelete = 0; + $sql= "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='".$FactorID."'"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_row($result); + if ($myrow[0] > 0) { + $CancelDelete = 1; + prnMsg(_('Cannot delete this factor because there are suppliers using them'),'warn'); + echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); + } - // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts - - $sql= "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='".$FactorID."'"; + if ($CancelDelete == 0) { + $sql="DELETE FROM factorcompanies WHERE id='".$FactorID."'"; $result = DB_query($sql, $db); - $myrow = DB_fetch_row($result); - if ($myrow[0] > 0) { - $CancelDelete = 1; - prnMsg(_('Cannot delete this factor because there are suppliers using them'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); - } - - if ($CancelDelete == 0) { - $sql="DELETE FROM factorcompanies WHERE id='".$FactorID."'"; - $result = DB_query($sql, $db); - prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'),'success'); - echo '<br>'; - unset($_SESSION['FactorID']); - } //end if Delete factor - } + prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'),'success'); + echo '<br />'; + unset($_SESSION['FactorID']); + } //end if Delete factor unset($FactorID); } -/* So the page hasn't called itself with the input/update/delete/buttons */ -/* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the - option to create a new one*/ -if (empty($FactorID)) { +/* So the page hasn't called itself with the input/update/delete/buttons */ - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo "<input type='hidden' name='New' VALUE='No'>"; - echo '<table class=selection><tr>'; - echo '<th>' . _('ID') . '</th>'; - echo '<th>' . _('Company Name').'</th>'; - echo '<th>' . _('Address 1').'</th>'; - echo '<th>' . _('Address 2').'</th>'; - echo '<th>' . _('Address 3').'</th>'; - echo '<th>' . _('Address 4').'</th>'; - echo '<th>' . _('Address 5').'</th>'; - echo '<th>' . _('Address 6').'</th>'; - echo '<th>' . _('Contact').'</th>'; - echo '<th>' . _('Telephone').'</th>'; - echo '<th>' . _('Fax Number').'</th>'; - echo '<th>' . _('Email').'</th></tr>'; - $sql = "SELECT id, - coyname, - address1, - address2, - address3, - address4, - address5, - address6, - contact, - telephone, - fax, - email - FROM factorcompanies"; - $result=DB_query($sql, $db); - $j=1; - while ($myrow = DB_fetch_array($result)) { - if ($j==1) { - echo '<tr class="OddTableRows">'; - $j=0; - } else { - echo '<tr class="EvenTableRows">'; - $j++; - } - echo '<td>' . $myrow['id'] . '</td>'; - echo '<td>' . $myrow['coyname'].'</td>'; - echo '<td>' . $myrow['address1'].'</td>'; - echo '<td>' . $myrow['address2'].'</td>'; - echo '<td>' . $myrow['address3'].'</td>'; - echo '<td>' . $myrow['address4'].'</td>'; - echo '<td>' . $myrow['address5'].'</td>'; - echo '<td>' . $myrow['address6'].'</td>'; - echo '<td>' . $myrow['contact'].'</td>'; - echo '<td>' . $myrow['telephone'].'</td>'; - echo '<td>' . $myrow['fax'].'</td>'; - echo '<td>' . $myrow['email'].'</td>'; - echo '<td><a href="'.$rootpath . '/Factors.php?' . SID . '&FactorID='.$myrow['id'].'">'._('Edit').'</a></td></tr>'; - } - echo "</table><p><div class='centre'>"; - echo "<br><input tabindex=3 type='Submit' name='Create' value='" . _('Create New Factor') . "'>"; - echo '</div></form>'; - include('includes/footer.inc'); - exit; +if (isset($FactorID) and isset($_POST['Amend'])) { -} - -if (isset($FactorID) and isset($_POST['amend'])) { - $sql = "SELECT id, coyname, address1, @@ -261,37 +194,119 @@ $_POST['Email'] = ''; } -if (isset($_POST['amend']) or isset($_POST['Create'])) { +if (isset($_POST['Amend']) or isset($_POST['Create'])) { // its a new factor being added - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo "<input type=hidden name='FactorID' value='".$FactorID."'>"; + echo '<input type="hidden" name="FactorID" value="' . $FactorID .'">'; echo '<table class=selection>'; - echo "<input type=hidden name='New' value='Yes'>"; - echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' size=42 maxlength=40 value='".$_POST['FactorName']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' size=42 maxlength=40 value='".$_POST['Address1']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' size=42 maxlength=40 value='".$_POST['Address2']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' size=42 maxlength=40 value='".$_POST['Address3']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' size=42 maxlength=40 value='".$_POST['Address4']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' size=42 maxlength=40 value='".$_POST['Address5']."'></td></tr>"; - echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' size=42 maxlength=40 value='".$_POST['Address6']."'></td></tr>"; - echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' size=13 maxlength=25 value='".$_POST['ContactName']."'></td></tr>"; - echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' size=13 maxlength=25 value='".$_POST['Telephone']."'></td></tr>"; - echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE=0 size=13 maxlength=25 value='".$_POST['Fax']."'></td></tr>"; - echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' size=55 maxlength=55 value='".$_POST['Email']."'></td></tr>"; + echo '<input type="hidden" name="New" value="Yes">'; + echo '<tr><td>' . _('Factor company Name') . ':</td> + <td><input tabindex=1 type="text" name="FactorName" size=42 maxlength=40 value="' .$_POST['FactorName'].'"></td></tr>'; + echo '<tr><td>' . _('Address Line 1') . ':</td> + <td><input tabindex=2 type="text" name="Address1" size=42 maxlength=40 value="' . $_POST['Address1'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 2') . ':</td> + <td><input tabindex=3 type="text" name="Address2" size=42 maxlength=40 value="' . $_POST['Address2'] .'"></td></tr>'; + + echo '<tr><td>' . _('Address Line 3') . ':</td> + <td><input tabindex=4 type="text" name="Address3" size=42 maxlength=40 value="' .$_POST['Address3'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 4') . ':</td> + <td><input tabindex=5 type="text" name="Address4" size=42 maxlength=40 value="' . $_POST['Address4'].'"></td></tr>'; + echo '<tr><td>' . _('Address Line 5') . ':</td> + <td><input tabindex=6 type="text" name="Address5" size=42 maxlength=40 value="' . $_POST['Address5'] .'"></td></tr>'; + echo '<tr><td>' . _('Address Line 6') . ':</td> + <td><input tabindex=7 type="text" name="Address6" size=42 maxlength=40 value="' .$_POST['Address6'] . '"></td></tr>'; + echo '<tr><td>' . _('Contact Name') . ':</td> + <td><input tabindex=8 type="text" name="ContactName" size=13 maxlength=25 value="' . $_POST['ContactName'] .'"></td></tr>'; + echo '<tr><td>' . _('Telephone') . ':</td> + <td><input tabindex=9 type="text" name="Telephone" size=13 maxlength=25 value="' .$_POST['Telephone'].'"></td></tr>'; + echo '<tr><td>' . _('Fax') . ':</td> + <td><input tabindex=10 type="text" name="Fax" value=0 size=13 maxlength=25 value="' . $_POST['Fax'] .'"></td></tr>'; + echo '<tr><td>' . _('Email') . ':</td> + <td><input tabindex=11 type="text" name="Email" size=55 maxlength=55 value="' . $_POST['Email'] . '"></td></tr>'; echo '</form>'; } if (isset($_POST['Create'])) { - echo "</table><p><div class='centre'><input tabindex=12 type='Submit' name='submit' VALUE='" . _('Insert New Factor') . "'></div>"; -} else if (isset($_POST['amend'])) { - echo "</table><p><div class='centre'><input tabindex=13 type='Submit' name='update' VALUE='" . _('Update Factor') . "'><p>"; + echo '</table><p><div class="centre"><input tabindex=12 type="submit" name="Submit" value="' . _('Insert New Factor') . '"></div>'; +} else if (isset($_POST['Amend'])) { + echo '</table> + <p><div class="centre"><input tabindex=13 type="submit" name="Update" value="' . _('Update Factor') . '"><p>'; prnMsg ( _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no suppliers are using this factor before the deletion is processed'), 'warn'); - echo "<p><input tabindex=14 type='Submit' name='delete' VALUE='" . _('Delete Factor') . "' onclick=\"return confirm('" . _('Are you sure you wish to delete this factoring company?') . "');\"></form></div>"; + echo '<p><input tabindex=14 type="submit" name="Delete" value="' . _('Delete Factor') . '" onclick="return confirm(\'' . _('Are you sure you wish to delete this factoring company?') . '\');"></form></div>'; } +/* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the + option to create a new one*/ + +if (empty($FactorID) AND !isset($_POST['Create']) AND !isset($_POST['Amend'])) { + + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; + + echo '<input type="hidden" name="New" value="No">'; + echo '<table class=selection><tr> + <th>' . _('ID') . '</th> + <th>' . _('Company Name').'</th> + <th>' . _('Address 1').'</th> + <th>' . _('Address 2').'</th> + <th>' . _('Address 3').'</th> + <th>' . _('Address 4').'</th> + <th>' . _('Address 5').'</th> + <th>' . _('Address 6').'</th> + <th>' . _('Contact').'</th> + <th>' . _('Telephone').'</th> + <th>' . _('Fax Number').'</th> + <th>' . _('Email').'</th></tr>'; + $sql = "SELECT id, + coyname, + address1, + address2, + address3, + address4, + address5, + address6, + contact, + telephone, + fax, + email + FROM factorcompanies"; + $result=DB_query($sql, $db); + $j=1; + while ($myrow = DB_fetch_array($result)) { + if ($j==1) { + echo '<tr class="OddTableRows">'; + $j=0; + } else { + echo '<tr class="EvenTableRows">'; + $j++; + } + echo '<td>' . $myrow['id'] . '</td> + <td>' . $myrow['coyname'].'</td> + <td>' . $myrow['address1'].'</td> + <td>' . $myrow['address2'].'</td> + <td>' . $myrow['address3'].'</td> + <td>' . $myrow['address4'].'</td> + <td>' . $myrow['address5'].'</td> + <td>' . $myrow['address6'].'</td> + <td>' . $myrow['contact'].'</td> + <td>' . $myrow['telephone'].'</td> + <td>' . $myrow['fax'].'</td> + <td>' . $myrow['email'].'</td> + <td><a href="'.$rootpath . '/Factors.php?FactorID='.$myrow['id'].'">'._('Edit').'</a></td> + </tr>'; + } + echo '</table><p><div class="centre">'; + echo '<br /><input tabindex=3 type="submit" name="Create" value="' . _('Create New Factor') . '">'; + echo '</div></form>'; + include('includes/footer.inc'); + exit; + +} + + include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GLJournal.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -235,9 +235,8 @@ } echo '<table><tr> - <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal').":</td> - <td><input type='text' class='date' alt='".$_SESSION['DefaultDateFormat']."' name='JournalProcessDate' maxlength='10' size='11' value='" . - $_SESSION['JournalDetail']->JnlDate . "' /></td>"; + <td colspan="5"><table class="selection"><tr><td>'._('Date to Process Journal') . ':</td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="JournalProcessDate" maxlength="10" size="11" value="' . $_SESSION['JournalDetail']->JnlDate . '" /></td>'; echo '<td>' . _('Type') . ':</td> <td><select name="JournalType">'; @@ -261,9 +260,9 @@ echo '<tr><th colspan="3"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Line Entry') . '</b></font></div></th></tr>'; /*now set up a GLCode field to select from avaialble GL accounts */ -echo '<tr><th>' . _('GL Tag') . '</th>'; -echo '<th>' . _('GL Account Code') . '</th>'; -echo '<th>' . _('Select GL Account') . '</th></tr>'; +echo '<tr><th>' . _('GL Tag') . '</th> + <th>' . _('GL Account Code') . '</th> + <th>' . _('Select GL Account') . '</th></tr>'; /* Set upthe form for the transaction entry for a GL Payment Analysis item */ @@ -321,19 +320,17 @@ $_POST['Debit'] = ''; } -echo '</tr><tr><th>' . _('Debit') . '</th><td><input type="text" class="number" name = "Debit" ' . - 'onChange="eitherOr(this, '.'Credit'.')"'. - ' Maxlength="12" size="10" value="' . $_POST['Debit'] . '" /></td>'; -echo '</tr><tr><th>' . _('Credit') . '</th><td><input type="text" class="number" Name = "Credit" ' . - 'onChange="eitherOr(this, '.'Debit'.')"'. - ' Maxlength="12" size="10" value="' . $_POST['Credit'] . '" /></td>'; +echo '</tr><tr><th>' . _('Debit') . '</th> + <td><input type="text" class="number" name = "Debit" onChange="eitherOr(this, '.'Credit'.')" maxlength="12" size="10" value="' . $_POST['Debit'] . '" /></td>'; +echo '</tr><tr><th>' . _('Credit') . '</th> + <td><input type="text" class="number" Name = "Credit" onChange="eitherOr(this, '.'Debit'.')" maxlength="12" size="10" value="' . $_POST['Credit'] . '" /></td>'; echo '</tr><tr><td></td><td></td><th>'. _('Narrative'). '</th>'; echo '</tr><tr><th></th><th>' . _('GL Narrative') . '</th>'; echo '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; echo '</tr></table><br />'; /*Close the main table */ -echo '<div class="centre"><input type="submi2t" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; +echo '<div class="centre"><input type="submit" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; echo '<table class="selection" width="85%">'; @@ -369,8 +366,8 @@ } else { $TagDescription=$myrow[0]; } - echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td>'; - echo '<td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; + echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td> + <td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { echo '<td class="number">' . number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; $DebitTotal=$DebitTotal+$JournalItem->Amount; @@ -402,7 +399,7 @@ echo '</table>'; if (ABS($_SESSION['JournalDetail']->JournalTotal)<0.001 AND $_SESSION['JournalDetail']->GLItemCounter > 0){ - echo "<br /><br /><div class='centre'><input type='submit' name='CommitBatch' value='"._('Accept and Process Journal')."' /></div>"; + echo '<br /><br /><div class="centre"><input type="submit" name="CommitBatch" value="' ._('Accept and Process Journal').'" /></div>'; } elseif(count($_SESSION['JournalDetail']->GLEntries)>0) { echo '<br /><br />'; prnMsg(_('The journal must balance ie debits equal to credits before it can be processed'),'warn'); Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GLTags.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -80,7 +80,7 @@ echo '<tr><td>' . $myrow['tagref'].'</td> <td>' . $myrow['tagdescription'].'</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=edit">' . _('Edit') . '</a></td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete">' . _('Delete') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete" onclick="return confirm(\'' . _('Are you sure you wish to delete this GL tag?') . '\');">' . _('Delete') . '</a></td> </tr>'; } Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/GoodsReceived.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -79,10 +79,10 @@ echo '<table cellpadding=2 class=selection> <tr><th colspan="2"></th> - <th align="centre" colspan="3"><b>' . _('Supplier Units') . '</b></th> - <th></th> - <th align="centre" colspan="5"><b>' . _('Our Receiving Units') . '</b></th> - </tr> + <th align="centre" colspan="3"><b>' . _('Supplier Units') . '</b></th> + <th></th> + <th align="centre" colspan="5"><b>' . _('Our Receiving Units') . '</b></th> + </tr> <tr><th>' . _('Item Code') . '</th> <th>' . _('Description') . '</th> <th>' . _('Quantity') . '<br />' . _('Ordered') . '</th> Modified: trunk/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/MRPDemands.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,7 @@ <?php -/* $Revision: 1.5 $ */ + /* $Id$*/ + // Add, Edit, Delete, and List MRP demand records. Table is mrpdemands. // Have separate functions for each routine. Use pass-by-reference - (&$db,&$StockID) - // to pass values of $db and $StockID to functions. - when just used $db as variable, Modified: trunk/OffersReceived.php =================================================================== --- trunk/OffersReceived.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/OffersReceived.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -87,19 +87,20 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Supplier Offers') . '" alt="" />' . ' ' . _('Supplier Offers') . '</p>'; - echo '<table class=selection>'; - echo '<tr><th>'._('Offer ID').'</th>'; - echo '<th>'._('Supplier').'</th>'; - echo '<th>'._('Stock Item').'</th>'; - echo '<th>'._('Quantity').'</th>'; - echo '<th>'._('Units').'</th>'; - echo '<th>'._('Price').'</th>'; - echo '<th>'._('Total').'</th>'; - echo '<th>'._('Currency').'</th>'; - echo '<th>'._('Offer Expires').'</th>'; - echo '<th>'._('Accept').'</th>'; - echo '<th>'._('Reject').'</th>'; - echo '<th>'._('Defer').'</th></tr>'; + echo '<table class=selection> + <tr> + <th>'._('Offer ID').'</th> + <th>'._('Supplier').'</th> + <th>'._('Stock Item').'</th> + <th>'._('Quantity').'</th> + <th>'._('Units').'</th> + <th>'._('Price').'</th> + <th>'._('Total').'</th> + <th>'._('Currency').'</th> + <th>'._('Offer Expires').'</th> + <th>'._('Accept').'</th> + <th>'._('Reject').'</th> + <th>'._('Defer').'</th></tr>'; $k=0; while ($myrow=DB_fetch_array($result)) { @@ -110,22 +111,22 @@ echo '<tr class="OddTableRows">'; $k++; } - echo '<td>'.$myrow['offerid'].'</td>'; - echo '<td>'.$myrow['suppname'].'</td>'; - echo '<td>'.$myrow['description'].'</td>'; - echo '<td class=number>'.number_format($myrow['quantity'],$myrow['decimalplaces']).'</td>'; - echo '<td>'.$myrow['uom'].'</td>'; - echo '<td class=number>'.number_format($myrow['price'],2).'</td>'; - echo '<td class=number>'.number_format($myrow['price']*$myrow['quantity'],2).'</td>'; - echo '<td>'.$myrow['currcode'].'</td>'; - echo '<td>'.$myrow['expirydate'].'</td>'; - echo '<td><input type="radio" name="action'.$myrow['offerid'].'" value="1"></td>'; - echo '<td><input type="radio" name="action'.$myrow['offerid'].'" value="2"></td>'; - echo '<td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3"></td>'; - echo '<td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'"></td>'; - echo '</tr>'; + echo '<td>'.$myrow['offerid'].'</td> + <td>'.$myrow['suppname'].'</td> + <td>'.$myrow['description'].'</td> + <td class=number>'.number_format($myrow['quantity'],$myrow['decimalplaces']).'</td> + <td>'.$myrow['uom'].'</td> + <td class=number>'.number_format($myrow['price'],2).'</td> + <td class=number>'.number_format($myrow['price']*$myrow['quantity'],2).'</td> + <td>'.$myrow['currcode'].'</td> + <td>'.$myrow['expirydate'].'</td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="1"></td> + <td><input type="radio" name="action'.$myrow['offerid'].'" value="2"></td> + <td><input type="radio" checked name="action'.$myrow['offerid'].'" value="3"></td> + <td><input type="hidden" name="supplierid" value="'.$myrow['supplierid'].'"></td> + </tr>'; } - echo '<tr><td colspan=12><div class="centre"><input type=Submit name=submit value=' . _('Enter Information') . '></div></td></tr>'; + echo '<tr><td colspan=12><div class="centre"><input type="submit" name="submit" value=' . _('Enter Information') . '></div></td></tr>'; echo '</form></table>'; } else if(isset($_POST['submit']) and isset($_POST['supplierid'])) { include ('includes/htmlMimeMail.php'); @@ -203,7 +204,6 @@ unitprice, actprice, quantityord, - itemno, suppliersunit) VALUES ( '".$OrderNo."', @@ -213,7 +213,6 @@ '".$myrow['price']."', '".$myrow['price']."', '".$myrow['quantity']."', - '".$myrow['stockid']."', '".$myrow['uom']."')"; $result=DB_query($sql, $db); $sql="DELETE FROM offers WHERE offerid='".$AcceptID."'"; @@ -226,7 +225,7 @@ $result = $mail->send(array($Email), 'smtp'); prnMsg(_('The accepted offers from').' '.$SupplierName.' '._('have been converted to purchase orders and an email sent to') .' '.$Email."\n"._('Please review the order contents').' '.'<a href="'.$rootpath . - "/PO_Header.php?ModifyOrderNumber=" . $OrderNo.'">'._('here').'</a>"', 'success'); + '/PO_Header.php?ModifyOrderNumber=' . $OrderNo.'">'._('here').'</a>', 'success'); } if (sizeOf($rejects)>0){ $MailText=_('This email has been automatically generated by the webERP installation at').' '. @@ -259,4 +258,4 @@ } include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_AuthorisationLevels.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -67,8 +67,8 @@ cancreate='".$CanCreate."', offhold='".$OffHold."', authlevel='".$_POST['AuthLevel']."' - WHERE userid='".$_POST['UserID']."' - AND currabrev='".$_POST['CurrCode']."'"; + WHERE userid='".$_POST['UserID']."' + AND currabrev='".$_POST['CurrCode']."'"; $ErrMsg = _('The authentication details cannot be updated because'); $Result=DB_query($sql,$db,$ErrMsg); @@ -88,8 +88,8 @@ offhold, authlevel FROM purchorderauth - WHERE userid='".$_GET['UserID']."' - AND currabrev='".$_GET['Currency']."'"; + WHERE userid='".$_GET['UserID']."' + AND currabrev='".$_GET['Currency']."'"; $ErrMsg = _('The authentication details cannot be retrieved because'); $result=DB_query($sql,$db,$ErrMsg); $myrow=DB_fetch_array($result); @@ -100,7 +100,7 @@ $AuthLevel=$myrow['authlevel']; } -$sql='SELECT purchorderauth.userid, +$sql="SELECT purchorderauth.userid, www_users.realname, currencies.currabrev, currencies.currency, @@ -110,7 +110,7 @@ FROM purchorderauth INNER JOIN www_users ON purchorderauth.userid=www_users.userid INNER JOIN currencies - ON purchorderauth.currabrev=currencies.currabrev'; + ON purchorderauth.currabrev=currencies.currabrev"; $ErrMsg = _('The authentication details cannot be retrieved because'); $Result=DB_query($sql,$db,$ErrMsg); @@ -134,17 +134,18 @@ } else { $OffHold=_('No'); } - echo '<tr><td>' . $myrow['userid'] . '</td> - <td>' . $myrow['realname'] . '</td> - <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . -'&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . -'&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> - </tr>'; + echo '<tr> + <td>' . $myrow['userid'] . '</td> + <td>' . $myrow['realname'] . '</td> + <td>' . $myrow['currency'] . '</td> + <td>' . $CanCreate . '</td> + <td>' . $OffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . + '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . + '&Currency='.$myrow['currabrev'].'" onclick="return confirm(\'' . _('Are you sure you wish to delete this authorisation level?') . '\');">'._('Delete').'</td> + </tr>'; } echo '</table><br><br>'; @@ -158,7 +159,7 @@ echo '<input type=hidden name=UserID value="'.$UserID.'"'; } else { echo '<tr><td>'._('User ID').'</td><td><select name=UserID>'; - $usersql='SELECT userid FROM www_users'; + $usersql="SELECT userid FROM www_users"; $userresult=DB_query($usersql,$db); while ($myrow=DB_fetch_array($userresult)) { if ($myrow['userid']==$UserID) { @@ -174,12 +175,14 @@ $CurrencySQL="SELECT currency FROM currencies WHERE currabrev='".$Currency."'"; $CurrencyResult=DB_query($CurrencySQL,$db); $myrow=DB_fetch_array($CurrencyResult); - echo '<tr><td>'._('Currency').'</td> - <td>' . $myrow['currency'] . '</td></tr>'; + echo '<tr> + <td>'._('Currency').'</td> + <td>' . $myrow['currency'] . '</td> + </tr>'; echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; - $currencysql='SELECT currabrev,currency FROM currencies'; + $currencysql="SELECT currabrev,currency FROM currencies"; $currencyresult=DB_query($currencysql,$db); while ($myrow=DB_fetch_array($currencyresult)) { if ($myrow['currabrev']==$Currency) { Modified: trunk/PO_AuthoriseMyOrders.php =================================================================== --- trunk/PO_AuthoriseMyOrders.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_AuthoriseMyOrders.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,7 +1,7 @@ <?php /* $Id$*/ -//$PageSecurity = 4; + include('includes/session.inc'); $title = _('Authorise Purchase Orders'); @@ -11,22 +11,22 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="" />' . ' ' . $title . '</p>'; -$emailsql="SELECT email FROM www_users WHERE userid='".$_SESSION['UserID']."'"; -$emailresult=DB_query($emailsql, $db); -$emailrow=DB_fetch_array($emailresult); +$EmailSQL="SELECT email FROM www_users WHERE userid='".$_SESSION['UserID']."'"; +$EmailResult=DB_query($EmailSQL, $db); +$EmailRow=DB_fetch_array($EmailResult); -if (isset($_POST['updateall'])) { +if (isset($_POST['UpdateAll'])) { foreach ($_POST as $key => $value) { if (substr($key,0,6)=='status') { - $orderno=substr($key,6); - $status=$_POST['status'.$orderno]; - $comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:'. - $emailrow['email'].'">'.$_SESSION['UserID'].'</a><br>'.$_POST['comment']; + $OrderNo=substr($key,6); + $Status=$_POST['status'.$OrderNo]; + $Comment=date($_SESSION['DefaultDateFormat']).' - '._('Authorised by').' '.'<a href="mailto:' . $EmailRow['email'].'">'.$_SESSION['UserID'].'</a> + <br />' . $_POST['comment']; $sql="UPDATE purchorders - SET status='".$status."', - stat_comment='".$comment."', - allowprint=1 - WHERE orderno='".$orderno."'"; + SET status='".$Status."', + stat_comment='".$Comment."', + allowprint=1 + WHERE orderno='".$OrderNo."'"; $result=DB_query($sql, $db); } } @@ -38,91 +38,98 @@ suppliers.suppname, suppliers.currcode, www_users.realname, - www_users.email - FROM purchorders - LEFT JOIN suppliers + www_users.email, + currencies.decimalplaces + FROM purchorders INNER JOIN suppliers ON suppliers.supplierid=purchorders.supplierno - LEFT JOIN www_users + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + INNER JOIN www_users ON www_users.userid=purchorders.initiator WHERE status='Pending'"; $result=DB_query($sql, $db); echo '<form method=post action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<table class=selection><tr>'; +echo '<table class="selection">'; /* Create the table for the purchase order header */ -echo '<th>'._('Order Number').'</th>'; -echo '<th>'._('Supplier').'</th>'; -echo '<th>'._('Date Ordered').'</th>'; -echo '<th>'._('Initiator').'</th>'; -echo '<th>'._('Delivery Date').'</th>'; -echo '<th>'._('Status').'</th>'; -echo '</tr>'; +echo '<tr> + <th>'._('Order Number').'</th> + <th>'._('Supplier').'</th> + <th>'._('Date Ordered').'</th> + <th>'._('Initiator').'</th> + <th>'._('Delivery Date').'</th> + <th>'._('Status').'</th> + </tr>'; while ($myrow=DB_fetch_array($result)) { - $authsql="SELECT authlevel FROM purchorderauth + $AuthSQL="SELECT authlevel FROM purchorderauth WHERE userid='".$_SESSION['UserID']."' AND currabrev='".$myrow['currcode']."'"; - $authresult=DB_query($authsql, $db); - $myauthrow=DB_fetch_array($authresult); - $authlevel=$myauthrow['authlevel']; + $AuthResult=DB_query($AuthSQL, $db); + $myauthrow=DB_fetch_array($AuthResult); + $AuthLevel=$myauthrow['authlevel']; - $ordervaluesql="SELECT sum(unitprice*quantityord) as ordervalue + $OrderValueSQL="SELECT sum(unitprice*quantityord) as ordervalue FROM purchorderdetails WHERE orderno='".$myrow['orderno'] . "'"; - $ordervalueresult=DB_query($ordervaluesql, $db); - $myordervaluerow=DB_fetch_array($ordervalueresult); - $ordervalue=$myordervaluerow['ordervalue']; + $OrderValueResult=DB_query($OrderValueSQL, $db); + $MyOrderValueRow=DB_fetch_array($OrderValueResult); + $OrderValue=$MyOrderValueRow['ordervalue']; - if ($authlevel>=$ordervalue) { - echo '<tr>'; - echo '<td>'.$myrow['orderno'].'</td>'; - echo '<td>'.$myrow['suppname'].'</td>'; - echo '<td>'.ConvertSQLDate($myrow['orddate']).'</td>'; - echo '<td><a href="mailto:'.$myrow['email'].'">'.$myrow['realname'].'</td>'; - echo '<td>'.ConvertSQLDate($myrow['deliverydate']).'</td>'; - echo '<td><select name=status'.$myrow['orderno'].'>'; - echo '<option selected value="Pending">'._('Pending').'</option>'; - echo '<option value="Authorised">'._('Authorised').'</option>'; - echo '<option value="Rejected">'._('Rejected').'</option>'; - echo '<option value="Cancelled">'._('Cancelled').'</option>'; - echo '</select></td>'; - echo '</tr>'; + if ($AuthLevel>=$OrderValue) { + echo '<tr> + <td>'.$myrow['orderno'].'</td> + <td>'.$myrow['suppname'].'</td> + <td>'.ConvertSQLDate($myrow['orddate']).'</td> + <td><a href="mailto:'.$myrow['email'].'">'.$myrow['realname'].'</td> + <td>'.ConvertSQLDate($myrow['deliverydate']).'</td> + <td><select name=status'.$myrow['orderno'].'> + <option selected value="Pending">'._('Pending').'</option> + <option value="Authorised">'._('Authorised').'</option> + <option value="Rejected">'._('Rejected').'</option> + <option value="Cancelled">'._('Cancelled').'</option> + </select></td> + </tr>'; echo "<input type='hidden' name='comment' value='".$myrow['stat_comment']."'>"; - $linesql="SELECT purchorderdetails.*, + $LineSQL="SELECT purchorderdetails.*, stockmaster.description FROM purchorderdetails LEFT JOIN stockmaster ON stockmaster.stockid=purchorderdetails.itemcode WHERE orderno='".$myrow['orderno'] . "'"; - $lineresult=DB_query($linesql, $db); + $LineResult=DB_query($LineSQL, $db); - echo '<tr><td></td><td colspan=5 align=left><table class=selection align=left>'; - echo '<th>'._('Product').'</th>'; - echo '<th>'._('Quantity Ordered').'</th>'; - echo '<th>'._('Currency').'</th>'; - echo '<th>'._('Price').'</th>'; - echo '<th>'._('Line Total').'</th>'; - echo '</tr>'; + echo '<tr> + <td></td> + <td colspan="5" align="left"> + <table class="selection" align="left"> + <tr> + <th>'._('Product').'</th> + <th>'._('Quantity Ordered').'</th> + <th>'._('Currency').'</th> + <th>'._('Price').'</th> + <th>'._('Line Total').'</th> + </tr>'; - while ($linerow=DB_fetch_array($lineresult)) { - echo '<tr>'; - echo '<td>'.$linerow['description'].'</td>'; - echo '<td class="number">'.number_format($linerow['quantityord'],2).'</td>'; - echo '<td>'.$myrow['currcode'].'</td>'; - echo '<td class="number">'.number_format($linerow['unitprice'],2).'</td>'; - echo '<td class="number">'.number_format($linerow['unitprice']*$linerow['quantityord'],2).'</td>'; - echo '</tr>'; + while ($linerow=DB_fetch_array($LineResult)) { + echo '<tr> + <td>'.$linerow['description'].'</td> + <td class="number">'.number_format($linerow['quantityord'],2).'</td> + <td>'.$myrow['currcode'].'</td> + <td class="number">'.number_format($linerow['unitprice'],$myrow['decimalplaces']).'</td> + <td class="number">'.number_format($linerow['unitprice']*$linerow['quantityord'],$myrow['decimalplaces']).'</td> + </tr>'; } // end while order line detail echo '</table></td></tr>'; } } //end while header loop echo '</table>'; -echo '<br><div class="centre"><input type="submit" name="updateall" value="' . _('Update'). '"></form>'; +echo '<br><div class="centre"><input type="submit" name="UpdateAll" value="' . _('Update'). '"></form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PO_SelectPurchOrder.php =================================================================== --- trunk/PO_SelectPurchOrder.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PO_SelectPurchOrder.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -1,6 +1,6 @@ <?php /* $Id$*/ -//$PageSecurity = 2; + include ('includes/session.inc'); $title = _('Search Purchase Orders'); include ('includes/header.inc'); @@ -110,14 +110,14 @@ while ($myrow = DB_fetch_array($resultStkLocs)) { if (isset($_POST['StockLocation'])) { if ($myrow['loccode'] == $_POST['StockLocation']) { - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode'] == $_SESSION['UserStockLocation']) { - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname']; + echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select> ' . _('Order Status:') .' <select name="Status">'; @@ -160,9 +160,9 @@ echo '<tr><td><font size=1>' . _('Select a stock category') . ':</font><select name="StockCat">'; while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $myrow1['categoryid'] == $_POST['StockCat']) { - echo "<option selected value='" . $myrow1['categoryid'] . "'>" . $myrow1['categorydescription']; + echo '<option selected value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } else { - echo "<option value='" . $myrow1['categoryid'] . "'>" . $myrow1['categorydescription']; + echo '<option value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } } echo '</select><td><font size=1>' . _('Enter text extracts in the') . ' <b>' . _('description') . '</b>:</font></td>'; @@ -191,12 +191,12 @@ echo '<tr bgcolor="#EEEEEE">'; $k = 1; } - echo "<td><input type=submit name='SelectedStockItem' value='" . $myrow['stockid'] . "'</td> - <td>" . $myrow['description'] . "</td> - <td class=number>" . $myrow['qoh'] . "</td> - <td class=number>" . $myrow['qord'] . "</td> - <td>" . $myrow['units'] . "</td> - </tr>"; + echo '<td><input type="submit" name="SelectedStockItem" value="' . $myrow['stockid'] . '"</td> + <td>' . $myrow['description'] . '</td> + <td class=number>' . $myrow['qoh'] . '</td> + <td class=number>' . $myrow['qord'] . '</td> + <td>' . $myrow['units'] . '</td> + </tr>'; $j++; if ($j == 12) { $j = 1; @@ -234,14 +234,25 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.orderno='" . $OrderNumber . "' - GROUP BY purchorders.orderno"; + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.orderno='" . $OrderNumber . "' + GROUP BY purchorders.orderno, + suppliers.suppname, + purchorders.orddate, + purchorders.initiator, + purchorders.requisitionno, + purchorders.allowprint, + purchorders.status, + suppliers.currcode, + currencies.decimalplaces"; } else { /* $DateAfterCriteria = FormatDateforSQL($OrdersAfterDate); */ if (empty($_POST['StockLocation'])) { @@ -257,13 +268,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorderdetails.itemcode='" . $SelectedStockItem . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorderdetails.itemcode='" . $SelectedStockItem . "' AND purchorders.supplierno='" . $SelectedSupplier . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " @@ -273,7 +287,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } else { $SQL = "SELECT purchorders.orderno, suppliers.suppname, @@ -283,13 +298,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.supplierno='" . $SelectedSupplier . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.supplierno='" . $SelectedSupplier . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, @@ -298,7 +316,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } } else { //no supplier selected if (isset($SelectedStockItem)) { @@ -310,13 +329,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, SUM(purchorderdetails.unitprice*purchorderdetails.quantityord) AS ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorderdetails.itemcode='" . $SelectedStockItem . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorderdetails.itemcode='" . $SelectedStockItem . "' AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, @@ -325,7 +347,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } else { $SQL = "SELECT purchorders.orderno, suppliers.suppname, @@ -335,13 +358,16 @@ purchorders.allowprint, purchorders.status, suppliers.currcode, + currencies.decimalplaces, sum(purchorderdetails.unitprice*purchorderdetails.quantityord) as ordervalue - FROM purchorders, - purchorderdetails, - suppliers - WHERE purchorders.orderno = purchorderdetails.orderno - AND purchorders.supplierno = suppliers.supplierid - AND purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' + FROM purchorders + INNER JOIN purchorderdetails + ON purchorders.orderno = purchorderdetails.orderno + INNER JOIN suppliers + ON purchorders.supplierno = suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE purchorders.intostocklocation = '" . $_POST['StockLocation'] . "' " . $StatusCriteria . " GROUP BY purchorders.orderno, suppliers.suppname, @@ -349,7 +375,8 @@ purchorders.initiator, purchorders.requisitionno, purchorders.allowprint, - suppliers.currcode"; + suppliers.currcode, + currencies.decimalplaces"; } } //end selected supplier @@ -360,15 +387,16 @@ if (DB_num_rows($PurchOrdersResult) > 0) { /*show a table of the orders returned by the SQL */ echo '<table cellpadding=2 colspan=7 width=90% class=selection>'; - $TableHeader = '<tr><th>' . _('View') . '</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Currency') . '</th> - <th>' . _('Requisition') . '</th> - <th>' . _('Order Date') . '</th> - <th>' . _('Initiator') . '</th> - <th>' . _('Order Total') . '</th> - <th>' . _('Status') . '</th> - </tr>'; + $TableHeader = '<tr> + <th>' . _('View') . '</th> + <th>' . _('Supplier') . '</th> + <th>' . _('Currency') . '</th> + <th>' . _('Requisition') . '</th> + <th>' . _('Order Date') . '</th> + <th>' . _('Initiator') . '</th> + <th>' . _('Order Total') . '</th> + <th>' . _('Status') . '</th> + </tr>'; echo $TableHeader; $j = 1; $k = 0; //row colour counter @@ -380,9 +408,9 @@ echo '<tr bgcolor="#EEEEEE">'; $k++; } - $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?' . SID . 'OrderNo=' . $myrow['orderno']; + $ViewPurchOrder = $rootpath . '/PO_OrderDetails.php?OrderNo=' . $myrow['orderno']; $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); - $FormatedOrderValue = number_format($myrow['ordervalue'], 2); + $FormatedOrderValue = number_format($myrow['ordervalue'], $myrow['decimalplaces']); /* View Supplier Currency Requisition Order Date Initiator Order Total ModifyPage, $myrow["orderno"], $myrow["suppname"], $myrow["currcode"], $myrow["requisitionno"] $FormatedOrderDate, $myrow["initiator"] $FormatedOrderValue Order Status*/ echo '<td><a href="' . $ViewPurchOrder . '">' . $myrow['orderno'] . '</a></td> Modified: trunk/Payments.php =================================================================== --- trunk/Payments.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/Payments.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -231,10 +231,10 @@ } /*Make an array of the defined bank accounts */ - $SQL = 'SELECT bankaccounts.accountcode + $SQL = "SELECT bankaccounts.accountcode FROM bankaccounts, chartmaster - WHERE bankaccounts.accountcode=chartmaster.accountcode'; + WHERE bankaccounts.accountcode=chartmaster.accountcode"; $result = DB_query($SQL,$db); $BankAccounts = array(); $i=0; @@ -270,8 +270,8 @@ } else { //Start a transaction to do the whole lot inside - $SQL = 'BEGIN'; - $result = DB_query($SQL,$db); + + $result = DB_Txn_Begin($db); if ($_SESSION['PaymentDetail']->SupplierID=='') { @@ -643,7 +643,7 @@ } else if ($_POST['GLCode'] == '') { prnMsg( _('No General Ledger code has been chosen') . ' - ' . _('so this GL analysis item could not be added'),'warn'); } else { - $SQL = "select accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; + $SQL = "SELECT accountname FROM chartmaster WHERE accountcode='" . $_POST['GLCode'] . "'"; $Result=DB_query($SQL,$db); $myrow=DB_fetch_array($Result); $_SESSION['PaymentDetail']->add_to_glanalysis($_POST['GLAmount'], @@ -702,7 +702,7 @@ } -echo '<form action=' . $_SERVER['PHP_SELF'] . '?' . SID . ' method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; Modified: trunk/PcAssignCashToTab.php =================================================================== --- trunk/PcAssignCashToTab.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PcAssignCashToTab.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -49,8 +49,8 @@ } $sqlLimit = "SELECT tablimit - FROM pctabs - WHERE tabcode='" . $SelectedTabs . "'"; + FROM pctabs + WHERE tabcode='" . $SelectedTabs . "'"; $ResultLimit = DB_query($sqlLimit,$db); $Limit=DB_fetch_array($ResultLimit); @@ -63,10 +63,10 @@ $sql = "UPDATE pcashdetails SET date = '".FormatDateForSQL($_POST['Date'])."', - amount = '" . $_POST['Amount'] . "', - authorized = '0000-00-00', - notes = '" . $_POST['Notes'] . "', - receipt = '" . $_POST['Receipt'] . "' + amount = '" . $_POST['Amount'] . "', + authorized = '0000-00-00', + notes = '" . $_POST['Notes'] . "', + receipt = '" . $_POST['Receipt'] . "' WHERE counterindex = '" . $SelectedIndex . "'"; $msg = _('Assignment of cash to PC Tab ') . ' ' . $SelectedTabs . ' ' . _('has been updated'); @@ -163,7 +163,7 @@ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $title. '</p>'; } - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Details Of Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Details Of Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div>'; if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ @@ -263,7 +263,7 @@ } echo '<tr><td colspan="2" style="text-align:right"><b>' . _('Current balance') . ':</b></td> - <td>' . number_format($Amount['0'],2) . '</td></tr>'; + <td>' . number_format($Amount['0'],2) . '</td></tr>'; echo '</table>'; @@ -277,7 +277,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] .'">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p><table class=selection>'; //Main table + echo '<p><table class="selection">'; //Main table if (isset($_GET['SelectedIndex'])) { echo '<tr><th colspan="2"><font color=blue size=3>'._('Update Cash Assignment').'</font></th></tr>'; } else { Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2011-05-11 10:03:40 UTC (rev 4564) +++ trunk/PcClaimExpensesFromTab.php 2011-05-13 10:50:42 UTC (rev 4565) @@ -43,7 +43,7 @@ if ($_POST['amount']==0) { $InputError = 1; - prnMsg('<br>' . _('The Amount must be greater than 0'),'error'); + prnMsg( _('The Amount must be greater than 0'),'error'); $Errors[$i] = 'TabCode'; $i++; } @@ -83,7 +83,7 @@ '" . $_POST['Receipt'] . "' )"; - $msg = _('The Expense Claim on Tab') . ' ' . $_POST["SelectedTabs"] . ' ' . _('has been created'); + $msg = _('The Expense Claim on Tab') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); } if ( $InputError !=1) { @@ -154,7 +154,7 @@ //end of ifs and buts! if (isset($_POST['process'])OR isset($SelectedTabs)) { - echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; + echo '<p><div class="centre"><a href="' . $_SERVER['PHP_SELF'] . '">' . _('Petty Cash Tab ') . '' .$SelectedTabs. '<a/></div><p>'; /* RICARD */ if (! isset($_GET['edit']) OR isset ($_POST['GO'])){ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; @@ -186,13 +186,13 @@ echo '<br><table border=1>'; echo '<tr> - <th>' . _('Date Of Expense') . '</th> - <th>' . _('Expense Description') . '</th> - <th>' . _('Amount') . '</th> - <th>' . _('Authorized') . '</th> - <th>' . _('Notes') . '</th> - <th>' . _('Receipt') . '</th> - </tr>'; + <th>' . _('Date Of Expense') . '</th> + <th>' . _('Expense Description') . '</th> + <th>' . _('Amount') . '</th> + <th>' . _('Authorized') . '</th> + <th>' . _('Notes') . '</th> + <th>' . _('Receipt') . '</th> + </tr>'; $k=0; //row colour counter @@ -216,17 +216,17 @@ $Description['0']='ASSIGNCASH'; } - if (($myrow['5'] == "0000-00-00") and ($Description['0'] != 'ASSIGNCASH')){ + if (($myrow['5'] == '0000-00-00') and ($Description['0'] != 'ASSIGNCASH')){ // only movements NOT authorized can be modified or deleted - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - <td><a href='%sSelectedIndex=%s&SelectedTabs=$SelectedTabs&Days=$Days&edit=yes'>" . _('Edit') . "</td> - <td><a href='%sSelectedIndex=%s&SelectedTabs=$SelectedTabs&Days=$Days&delete=yes' onclick=\"return confirm('" . _('Are you sure you wish to delete this code and the expense it may have set up?') . "');\">" . _('Delete') . "</td> - </tr>", + <td><a href="%sSelectedIndex=%s&SelectedTabs=' . $SelectedTabs . '&Days=' . $Days . '&edit=yes">' . _('Edit') . '</td> + <td><a href="%sSelectedIndex=%s&SelectedTabs=' . $SelectedTabs . '&Days=' . $Days . '&delete=yes" onclick=\'return confirm("' . _('Are you sure you wish to delete this code and the expenses it may have set up?') . '");\'>' . _('Delete') . '</td> + </tr>', ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), @@ -236,13 +236,13 @@ $_SERVER['PHP_SELF'] . '?', $myrow['0'], $_SERVER['PHP_SELF'] . '?', $myrow['0']); } else { - printf("<td>%s</td> + printf('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> - </tr>", + </tr>', ConvertSQLDate($myrow['2']), $Description['0'], number_format($myrow['4'],2), @@ -325,7 +325,7 @@ if (isset($_POST['SelectedExpense']) and $myrow['codeexpense']==$_POST['SelectedExpense']) { echo '<option selected value="'; } else { - echo '<option VALUE="'; + echo '<option value="'; } echo $myrow['codeexpense'] . '">' . $myrow['codeexpense'] . ' - ' . $myrow['description'] . '</option>'; @@ -357,7 +357,7 @@ echo '<input type="hidden" name="Days" value="' .$Days. '">'; echo '</table>'; // close table in first column echo '</td></tr></table>'; // close main table - echo '<p><div class="centre"><input type=submit name=submit VALUE="' . _('Accept') . '"><in... [truncated message content] |
From: <dai...@us...> - 2011-05-11 10:03:49
|
Revision: 4564 http://web-erp.svn.sourceforge.net/web-erp/?rev=4564&view=rev Author: daintree Date: 2011-05-11 10:03:40 +0000 (Wed, 11 May 2011) Log Message: ----------- various Removed Paths: ------------- trunk/companies/weberpdemo/pdf_append/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-11 10:03:46
|
Revision: 4564 http://web-erp.svn.sourceforge.net/web-erp/?rev=4564&view=rev Author: daintree Date: 2011-05-11 10:03:40 +0000 (Wed, 11 May 2011) Log Message: ----------- various Removed Paths: ------------- trunk/companies/weberpdemo/pdf_append/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2011-05-11 09:59:52
|
Revision: 4563 http://web-erp.svn.sourceforge.net/web-erp/?rev=4563&view=rev Author: daintree Date: 2011-05-11 09:59:44 +0000 (Wed, 11 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/AccountSections.php trunk/Areas.php trunk/AuditTrail.php trunk/CustomerTypes.php trunk/FixedAssetItems.php trunk/FormDesigner.php trunk/GLJournal.php trunk/GLTags.php trunk/PDFBankingSummary.php trunk/PDFOrderStatus.php trunk/PO_AuthorisationLevels.php trunk/SecurityTokens.php trunk/Shipt_Select.php trunk/Stocks.php trunk/SupplierAllocations.php trunk/UpgradeDatabase.php trunk/Z_ImportStocks.php trunk/Z_MakeNewCompany.php trunk/doc/Change.log trunk/includes/session.inc Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/AccountSections.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -28,7 +28,7 @@ $myrow = DB_fetch_row($result); if( $myrow[0] == 0 ) { $sql = "INSERT INTO accountsection ( - sectionid, + sectionid,21 sectionname ) VALUES ( 2, @@ -68,9 +68,9 @@ $i++; } } - if (strpos($_POST['SectionName'],'&')>0 OR strpos($_POST['SectionName'],"'")>0) { + if (ContainsIllegalCharacters($_POST['SectionName'])>0) { $InputError = 1; - prnMsg( _('The account section name cannot contain the character') . " '&' " . _('or the character') ." '",'error'); + prnMsg( _('The account section name cannot contain any of the illegal characters') ." '",'error'); $Errors[$i] = 'SectionName'; $i++; } @@ -274,4 +274,4 @@ } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Areas.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -138,16 +138,17 @@ if (!isset($SelectedArea)) { - $sql = 'SELECT * FROM areas'; + $sql = "SELECT * FROM areas"; $result = DB_query($sql,$db); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - echo '<table>'; - echo "<tr> - <th>" . _('Area Code') . "</th> - <th>" . _('Area Name') . '</th>'; + echo '<table> + <tr> + <th>' . _('Area Code') . '</th> + <th>' . _('Area Name') . '</th> + </tr>'; $k=0; //row colour counter @@ -159,13 +160,11 @@ echo '<tr class="OddTableRows">'; $k++; } - - echo '<td>' . $myrow[0] . '</td>'; - echo '<td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedArea=' . $myrow[0] . '&delete=yes">' . _('Delete') . '</a></td>'; - echo '<td><a href="SelectCustomer.php'. '?' . SID . '&Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; - + echo '<td>' . $myrow[0] . '</td> + <td>' . $myrow[1] . '</td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '&delete=yes">' . _('Delete') . '</a></td>'; + echo '<td><a href="SelectCustomer.php'. '?Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; } //END WHILE LIST LOOP echo '</table>'; Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/AuditTrail.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -101,7 +101,8 @@ $SQLString = str_replace('SET','',$SQLString); $SQLString = str_replace('WHERE',',',$SQLString); $SQLString = str_replace('AND',',',$SQLString); - $FieldArray = preg_split("/[[:space:]]*([[:alnum:].]+[[:space:]]*=[[:space:]]*(?:'[^']*'|[[:digit:].]+))[[:space:]]*,/", $SQLString, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); for ($i=0; $i<sizeof($FieldArray); $i++) { + $FieldArray = preg_split("/[[:space:]]*([[:alnum:].]+[[:space:]]*=[[:space:]]*(?:'[^']*'|[[:digit:].]+))[[:space:]]*,/", $SQLString, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); + for ($i=0; $i<sizeof($FieldArray); $i++) { $Assigment = explode('=', $FieldArray[$i]); $_SESSION['SQLString']['fields'][$i] = $Assigment[0]; if (sizeof($Assigment)>1) { @@ -176,7 +177,7 @@ if (isset($_SESSION['SQLString']['values'][$i]) and (trim(str_replace("'","",$_SESSION['SQLString']['values'][$i])) != "") & (trim($_SESSION['SQLString']['fields'][$i]) != 'password') & (trim($_SESSION['SQLString']['fields'][$i]) != "www_users.password")) { - echo '<tr bgcolor='.$RowColour.'>'; + echo '<tr bgcolor="' . $RowColour . '">'; echo '<td></td> <td></td> <td></td> @@ -186,7 +187,7 @@ echo '</tr>'; } } - echo '<tr bgcolor=black><td></td><td></td><td></td><td></td><td></td><td></td></tr>'; + echo '<tr bgcolor=black> <td colspan="6"></td> </tr>'; } unset($_SESSION['SQLString']); } Modified: trunk/CustomerTypes.php =================================================================== --- trunk/CustomerTypes.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/CustomerTypes.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -177,7 +177,7 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT typeid, typename FROM debtortype'; + $sql = "SELECT typeid, typename FROM debtortype"; $result = DB_query($sql,$db); echo '<br /><table class=selection>'; @@ -255,9 +255,11 @@ if (!isset($_POST['typename'])) { $_POST['typename']=''; } - echo '<tr><td>' . _('Type Name') . ':</td><td><input type="Text" name="typename" value="' . $_POST['typename'] . '"></td></tr>'; + echo '<tr><td>' . _('Type Name') . ':</td> + <td><input type="Text" name="typename" value="' . $_POST['typename'] . '"></td></tr>'; - echo '</td></tr></table>'; // close main table + echo '</td></tr> + </table>'; // close main table echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"></div>'; @@ -265,6 +267,5 @@ } // end if user wish to delete - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/FixedAssetItems.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -130,9 +130,9 @@ $PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db); /* Get the new account codes for the new asset category */ $result = DB_query("SELECT costact, - accumdepnact - FROM fixedassetcategories - WHERE categoryid='" . $_POST['AssetCategoryID'] . "'",$db); + accumdepnact + FROM fixedassetcategories + WHERE categoryid='" . $_POST['AssetCategoryID'] . "'",$db); $NewAccounts = DB_fetch_array($result); $TransNo = GetNextTransNo( 42, $db); /* transaction type is asset category change */ @@ -145,7 +145,7 @@ account, narrative, amount) - VALUES ('42', + VALUES ('42', '" . $TransNo . "', '" . Date('Y-m-d') . "', '" . $PeriodNo . "', @@ -159,75 +159,75 @@ //debit cost for the new category $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES ('42', - '" . $TransNo . "', - '" . Date('Y-m-d') . "', - '" . $PeriodNo . "', - '" . $NewAccounts['costact'] . "', - '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', - '" . $OldDetails['cost']. "' - )"; + '" . $TransNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $NewAccounts['costact'] . "', + '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', + '" . $OldDetails['cost']. "' + )"; $ErrMsg = _('Cannot insert a GL entry for the change of asset category because'); $DbgMsg = _('The SQL that failed to insert the cost GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); if ($OldDetails['accumdepn']!=0) { //debit accumdepn for the old category $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ('42', - '" . $TransNo . "', - '" . Date('Y-m-d') . "', - '" . $PeriodNo . "', - '" . $OldDetails['accumdepnact'] . "', - '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', - '" . $OldDetails['accumdepn']. "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ('42', + '" . $TransNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $OldDetails['accumdepnact'] . "', + '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', + '" . $OldDetails['accumdepn']. "' + )"; $ErrMsg = _('Cannot insert a GL entry for the change of asset category because'); $DbgMsg = _('The SQL that failed to insert the cost GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); //credit accum depn for the new category $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ('42', - '" . $TransNo . "', - '" . Date('Y-m-d') . "', - '" . $PeriodNo . "', - '" . $NewAccounts['accumdepnact'] . "', - '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', - '" . $OldDetails['accumdepn']. "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ('42', + '" . $TransNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $NewAccounts['accumdepnact'] . "', + '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', + '" . $OldDetails['accumdepn']. "' + )"; $ErrMsg = _('Cannot insert a GL entry for the change of asset category because'); $DbgMsg = _('The SQL that failed to insert the cost GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } /*end if there was accumulated depreciation for the asset */ } /* end if there is a change in asset category */ $sql = "UPDATE fixedassets - SET longdescription='" . $_POST['LongDescription'] . "', - description='" . $_POST['Description'] . "', - assetcategoryid='" . $_POST['AssetCategoryID'] . "', - assetlocation='" . $_POST['AssetLocation'] . "', - depntype='" . $_POST['DepnType'] . "', - depnrate='" . $_POST['DepnRate'] . "', - barcode='" . $_POST['BarCode'] . "', - serialno='" . $_POST['SerialNo'] . "' - WHERE assetid='" . $AssetID . "'"; + SET longdescription='" . $_POST['LongDescription'] . "', + description='" . $_POST['Description'] . "', + assetcategoryid='" . $_POST['AssetCategoryID'] . "', + assetlocation='" . $_POST['AssetLocation'] . "', + depntype='" . $_POST['DepnType'] . "', + depnrate='" . $_POST['DepnRate'] . "', + barcode='" . $_POST['BarCode'] . "', + serialno='" . $_POST['SerialNo'] . "' + WHERE assetid='" . $AssetID . "'"; $ErrMsg = _('The asset could not be updated because'); $DbgMsg = _('The SQL that was used to update the asset and failed was'); @@ -237,22 +237,22 @@ echo '<br />'; } else { //it is a NEW part $sql = "INSERT INTO fixedassets (description, - longdescription, - assetcategoryid, - assetlocation, - depntype, - depnrate, - barcode, - serialno) - VALUES ( - '" . $_POST['Description'] . "', - '" . $_POST['LongDescription'] . "', - '" . $_POST['AssetCategoryID'] . "', - '" . $_POST['AssetLocation'] . "', - '" . $_POST['DepnType'] . "', - '" . $_POST['DepnRate']. "', - '" . $_POST['BarCode'] . "', - '" . $_POST['SerialNo'] . "' )"; + longdescription, + assetcategoryid, + assetlocation, + depntype, + depnrate, + barcode, + serialno) + VALUES ( + '" . $_POST['Description'] . "', + '" . $_POST['LongDescription'] . "', + '" . $_POST['AssetCategoryID'] . "', + '" . $_POST['AssetLocation'] . "', + '" . $_POST['DepnType'] . "', + '" . $_POST['DepnRate']. "', + '" . $_POST['BarCode'] . "', + '" . $_POST['SerialNo'] . "' )"; $ErrMsg = _('The asset could not be added because'); $DbgMsg = _('The SQL that was used to add the asset failed was'); $result = DB_query($sql,$db, $ErrMsg, $DbgMsg); @@ -278,12 +278,12 @@ $CancelDelete = 0; //what validation is required before allowing deletion of assets .... maybe there should be no deletion option? $result = DB_query("SELECT cost, - accumdepn, - accumdepnact, - costact - FROM fixedassets INNER JOIN fixedassetcategories - ON fixedassets.assetcategoryid=fixedassetcategories.categoryid - WHERE assetid='" . $AssetID . "'", $db); + accumdepn, + accumdepnact, + costact + FROM fixedassets INNER JOIN fixedassetcategories + ON fixedassets.assetcategoryid=fixedassetcategories.categoryid + WHERE assetid='" . $AssetID . "'", $db); $AssetRow = DB_fetch_array($result); $NBV = $AssetRow['cost'] -$AssetRow['accumdepn']; if ($NBV!=0) { @@ -309,40 +309,40 @@ if ($AssetRow['cost'] > 0){ //credit cost for the asset deleted $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ('43', - '" . $TransNo . "', - '" . Date('Y-m-d') . "', - '" . $PeriodNo . "', - '" . $AssetRow['costact'] . "', - '" . _('Delete asset') . ' ' . $AssetID . "', - '" . -$AssetRow['cost']. "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ('43', + '" . $TransNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $AssetRow['costact'] . "', + '" . _('Delete asset') . ' ' . $AssetID . "', + '" . -$AssetRow['cost']. "' + )"; $ErrMsg = _('Cannot insert a GL entry for the deletion of the asset because'); $DbgMsg = _('The SQL that failed to insert the cost GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); //debit accumdepn for the depreciation removed on deletion of this asset $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ('43', - '" . $TransNo . "', - '" . Date('Y-m-d') . "', - '" . $PeriodNo . "', - '" . $AssetRow['accumdepnact'] . "', - '" . _('Delete asset') . ' ' . $AssetID . "', - '" . $Asset['accumdepn']. "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ('43', + '" . $TransNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $AssetRow['accumdepnact'] . "', + '" . _('Delete asset') . ' ' . $AssetID . "', + '" . $Asset['accumdepn']. "' + )"; $ErrMsg = _('Cannot insert a GL entry for the reversal of accumulated depreciation on deletion of the asset because'); $DbgMsg = _('The SQL that failed to insert the cost GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -394,17 +394,17 @@ } elseif ($InputError!=1) { // Must be modifying an existing item and no changes made yet - need to lookup the details $sql = "SELECT assetid, - description, - longdescription, - assetcategoryid, - serialno, - assetlocation, - datepurchased, - depntype, - depnrate, - cost, - accumdepn, - barcode + description, + longdescription, + assetcategoryid, + serialno, + assetlocation, + datepurchased, + depntype, + depnrate, + cost, + accumdepn, + barcode FROM fixedassets WHERE assetid ='" . $AssetID . "'"; @@ -421,11 +421,11 @@ $_POST['DepnRate'] = $AssetRow['depnrate']; echo '<tr><td>' . _('Asset Code') . ':</td><td>'.$AssetID.'</td></tr>'. "\n"; - echo '<input type="Hidden" name="AssetID" value='.$AssetID.'>'. "\n"; + echo '<input type="Hidden" name="AssetID" value="'.$AssetID.'"/>'. "\n"; } else { // some changes were made to the data so don't re-set form variables to DB ie the code above echo '<tr><td>' . _('Asset Code') . ':</td><td>' . $AssetID . '</td></tr>'; - echo '<input type="Hidden" name="AssetID" value="' . $AssetID . '">'; + echo '<input type="Hidden" name="AssetID" value="' . $AssetID . '"/>'; } if (isset($_POST['Description'])) { @@ -434,7 +434,7 @@ $Description =''; } echo '<tr><td>' . _('Asset Description') . ' (' . _('short') . '):</td> - <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Description" size=52 maxlength=50 value="' . $Description . '"></td></tr>'."\n"; + <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Description" size=52 maxlength=50 value="' . $Description . '"></td></tr>'."\n"; if (isset($_POST['LongDescription'])) { $LongDescription = AddCarriageReturns($_POST['LongDescription']); Modified: trunk/FormDesigner.php =================================================================== --- trunk/FormDesigner.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/FormDesigner.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -1,6 +1,6 @@ <?php /* $Id$ */ -//$PageSecurity = 14; + include('includes/session.inc'); $title = _('Form Designer'); include('includes/header.inc'); @@ -108,9 +108,6 @@ case 'GoodsReceived.xml': echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PDFGrn.php?' . SID .'GRNNo=Preview&PONo=1">'; break; - case 'SalesInvoice.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PrintCustTrans.php?' . SID .'FromTransNo=Preview&InvOrCredit=Invoice&PrintPDF=True">'; - break; case 'PickingList.xml': echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PDFPickingList.php?' . SID .'TransNo=Preview">'; break; Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/GLJournal.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -22,7 +22,7 @@ Journals cannot be entered against bank accounts GL postings involving bank accounts must be done using a receipt or a payment transaction to ensure a bank trans is available for matching off vs statements */ - $SQL = 'SELECT accountcode FROM bankaccounts'; + $SQL = "SELECT accountcode FROM bankaccounts"; $result = DB_query($SQL,$db); $i=0; while ($Act = DB_fetch_row($result)){ @@ -158,8 +158,8 @@ if ($AllowThisPosting) { $SQL = "SELECT accountname - FROM chartmaster - WHERE accountcode='" . $_POST['GLManualCode'] . "'"; + FROM chartmaster + WHERE accountcode='" . $_POST['GLManualCode'] . "'"; $Result=DB_query($SQL,$db); if (DB_num_rows($Result)==0){ @@ -270,13 +270,13 @@ //Select the tag echo '<tr><td><select name="tag">'; -$SQL = 'SELECT tagref, - tagdescription +$SQL = "SELECT tagref, + tagdescription FROM tags - ORDER BY tagref'; + ORDER BY tagref"; $result=DB_query($SQL,$db); -echo '<option value="0">0 - None</option>'; +echo '<option value="0">0 - ' . _('None') . '</option>'; while ($myrow=DB_fetch_array($result)){ if (isset($_POST['tag']) and $_POST['tag']==$myrow['tagref']){ echo '<option selected value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'].'</option>'; @@ -294,10 +294,10 @@ "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . ' value="'. $_POST['GLManualCode'] .'" /></td>'; -$sql='SELECT accountcode, - accountname - FROM chartmaster - ORDER BY accountcode'; +$sql="SELECT accountcode, + accountname + FROM chartmaster + ORDER BY accountcode"; $result=DB_query($sql, $db); echo '<td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; @@ -321,7 +321,7 @@ $_POST['Debit'] = ''; } -echo '</tr><tr><th>' . _('Debit') . '</th>'.'<td><input type="text" class="number" Name = "Debit" ' . +echo '</tr><tr><th>' . _('Debit') . '</th><td><input type="text" class="number" name = "Debit" ' . 'onChange="eitherOr(this, '.'Credit'.')"'. ' Maxlength="12" size="10" value="' . $_POST['Debit'] . '" /></td>'; echo '</tr><tr><th>' . _('Credit') . '</th><td><input type="text" class="number" Name = "Credit" ' . @@ -333,21 +333,22 @@ echo '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; echo '</tr></table><br />'; /*Close the main table */ -echo "<div class='centre'><input type='submit' name='Process' value='" . _('Accept') . "' /></div><br /><br />"; +echo '<div class="centre"><input type="submi2t" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; echo '<table class="selection" width="85%">'; echo '<tr><th colspan="6"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Summary') . '</b></font></div></th></tr>'; echo '<tr> - <th>'._('GL Tag').'</th> - <th>'._('GL Account').'</th> - <th>'._('Debit').'</th> - <th>'._('Credit').'</th> - <th>'._('Narrative').'</th></tr>'; + <th>'._('GL Tag').'</th> + <th>'._('GL Account').'</th> + <th>'._('Debit').'</th> + <th>'._('Credit').'</th> + <th>'._('Narrative').'</th> + </tr>'; -$debittotal=0; -$credittotal=0; +$DebitTotal=0; +$CreditTotal=0; $j=0; foreach ($_SESSION['JournalDetail']->GLEntries as $JournalItem) { @@ -364,39 +365,38 @@ $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); if ($JournalItem->tag==0) { - $tagdescription='None'; + $TagDescription=_('None'); } else { - $tagdescription=$myrow[0]; + $TagDescription=$myrow[0]; } - echo '<td>' . $JournalItem->tag . ' - ' . $tagdescription . '</td>'; + echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td>'; echo '<td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { - echo '<td class="number">' . number_format($JournalItem->Amount,2) . '</td><td></td>'; - $debittotal=$debittotal+$JournalItem->Amount; - + echo '<td class="number">' . number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; + $DebitTotal=$DebitTotal+$JournalItem->Amount; } elseif($JournalItem->Amount<0) { - $credit=(-1 * $JournalItem->Amount); + $Credit=(-1 * $JournalItem->Amount); echo '<td></td> - <td class="number">' . number_format($credit,2) . '</td>'; - $credittotal=$credittotal+$credit; + <td class="number">' . number_format($Credit,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; + $CreditTotal=$CreditTotal+$Credit; } - echo '<td>' . $JournalItem->Narrative . "</td> - <td><a href='" . $_SERVER['PHP_SELF'] . '?Delete=' . $JournalItem->ID . "'>"._('Delete').'</a></td> + echo '<td>' . $JournalItem->Narrative . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $JournalItem->ID . '">' . _('Delete').'</a></td> </tr>'; } echo '<tr class="EvenTableRows"><td></td> - <td class="number"><b>' . _('Total') . '</b></td> - <td class="number"><b>' . number_format($debittotal,2) . '</b></td> - <td class="number"><b>' . number_format($credittotal,2) . '</b></td></tr>'; -if ($debittotal!=$credittotal) { + <td class="number"><b>' . _('Total') . '</b></td> + <td class="number"><b>' . number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + <td class="number"><b>' . number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; +if ($DebitTotal!=$CreditTotal) { echo '<td align="center" style="background-color: #fddbdb"><b>' . _('Required to balance') .' - </b>' . - number_format(abs($debittotal-$credittotal),2); + number_format(abs($DebitTotal-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']); } -if ($debittotal>$credittotal) { +if ($DebitTotal>$CreditTotal) { echo ' ' . _('Credit') . '</td></tr>'; -} else if ($debittotal<$credittotal) { +} else if ($DebitTotal<$CreditTotal) { echo ' ' . _('Debit') . '</td></tr>'; } echo '</table>'; @@ -409,9 +409,9 @@ } if (!isset($_GET['NewJournal']) or $_GET['NewJournal']=='') { - echo "<script>defaultControl(document.form.GLManualCode);</script>"; + echo '<script>defaultControl(document.form.GLManualCode);</script>'; } else { - echo "<script>defaultControl(document.form.JournalProcessDate);</script>"; + echo '<script>defaultControl(document.form.JournalProcessDate);</script>'; } echo '</form>'; Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/GLTags.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -8,39 +8,57 @@ include('includes/header.inc'); if (isset($_GET['SelectedTag'])) { - $sql="SELECT tagref, tagdescription FROM tags where tagref='".$_GET['SelectedTag']."'"; - $result= DB_query($sql,$db); - $myrow = DB_fetch_array($result,$db); - $ref=$myrow[0]; - $description=$myrow[1]; + if($_GET['Action']=='delete'){ + //first off test there are no transactions created with this tag + $Result = DB_query("SELECT counterindex + FROM gltrans + WHERE tag='" . $_GET['SelectedTag'] . "'",$db); + if (DB_num_rows($Result)>0){ + prnMsg(_('This tag cannot be deleted since there are already general ledger transactions created using it.'),'error'); + } else { + $Result = DB_query("DELETE FROM tags WHERE tagref='" . $_GET['SelectedTag'] . "'",$db); + prnMsg(_('The selected tag has been deleted'),'success'); + } + } else { + $sql="SELECT tagref, + tagdescription + FROM tags + WHERE tagref='".$_GET['SelectedTag']."'"; + + $result= DB_query($sql,$db); + $myrow = DB_fetch_array($result,$db); + $ref=$myrow['tagref']; + $Description=$myrow['tagdescription']; + } } else { - $description=''; + $Description=''; $_GET['SelectedTag']=''; } if (isset($_POST['submit'])) { - $sql = "INSERT INTO tags values(NULL, '".$_POST['description']."')"; + $sql = "INSERT INTO tags values(NULL, '".$_POST['Description']."')"; $result= DB_query($sql,$db); } if (isset($_POST['update'])) { - $sql = "UPDATE tags SET tagdescription='".$_POST['description']. - "' WHERE tagref='".$_POST['reference']."'"; + $sql = "UPDATE tags SET tagdescription='".$_POST['Description']. "' + WHERE tagref='".$_POST['reference']."'"; $result= DB_query($sql,$db); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . ' name="form">'; +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<br><table><tr>'; +echo '<br /> + <table><tr>'; echo '<td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="description" value="'.$description.'"></td><td> - <input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; + <td><input type="text" size=30 maxlength=30 name="Description" value="'.$Description.'"></td><td> + <input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; -if (isset($_GET['Action']) and $_GET['Action']=='edit') { +if (isset($_GET['Action']) AND $_GET['Action']=='edit') { echo '<input type="submit" name=update value=' . _('Update') . '>'; } else { echo '<input type="submit" name=submit value=' . _('Insert') . '>'; @@ -50,21 +68,25 @@ echo '</form>'; -echo '<table class=selection>'; -echo '<tr><th>'. _('Tag ID') .'</th>'; -echo '<th>'. _('Description'). '</th>'; +echo '<table class="selection">'; +echo '<tr><th>'. _('Tag ID') .'</th> + <th>'. _('Description'). '</th> + </tr>'; $sql="SELECT tagref, tagdescription FROM tags order by tagref"; $result= DB_query($sql,$db); while ($myrow = DB_fetch_array($result,$db)){ - echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>'; + echo '<tr><td>' . $myrow['tagref'].'</td> + <td>' . $myrow['tagdescription'].'</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=edit">' . _('Edit') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete">' . _('Delete') . '</a></td> + </tr>'; } echo '</table><p></p>'; -echo '<script>defaultControl(document.form.description);</script>'; +echo '<script>defaultControl(document.form.Description);</script>'; include('includes/footer.inc'); Modified: trunk/PDFBankingSummary.php =================================================================== --- trunk/PDFBankingSummary.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PDFBankingSummary.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -25,7 +25,7 @@ $result=DB_query($sql, $db); echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> - <table class=selection>'; + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Select the batch number of receipts to be printed') . ':</td>'; echo '<td><select name="BatchNo">'; @@ -41,19 +41,19 @@ if (isset($_POST['BatchNo']) and $_POST['BatchNo']!='') { $SQL= "SELECT bankaccountname, - bankaccountnumber, - ref, - transdate, - banktranstype, - bankact, - banktrans.exrate, - banktrans.functionalexrate, - banktrans.currcode - FROM bankaccounts, - banktrans - WHERE bankaccounts.accountcode=banktrans.bankact - AND banktrans.transno='" . $_POST['BatchNo'] . "' - AND banktrans.type=12"; + bankaccountnumber, + ref, + transdate, + banktranstype, + bankact, + banktrans.exrate, + banktrans.functionalexrate, + banktrans.currcode + FROM bankaccounts, + banktrans + WHERE bankaccounts.accountcode=banktrans.bankact + AND banktrans.transno='" . $_POST['BatchNo'] . "' + AND banktrans.type=12"; $ErrMsg = _('An error occurred getting the header information about the receipt batch number') . ' ' . $_POST['BatchNo']; $DbgMsg = _('The SQL used to get the receipt header information that failed was'); @@ -79,14 +79,14 @@ $SQL = "SELECT debtorsmaster.name, - ovamount, - invtext, - reference - FROM debtorsmaster INNER JOIN debtortrans - ON debtorsmaster.debtorno=debtortrans.debtorno - WHERE debtortrans.transno='" . $_POST['BatchNo'] . "' - AND debtortrans.type=12"; - + ovamount, + invtext, + reference + FROM debtorsmaster INNER JOIN debtortrans + ON debtorsmaster.debtorno=debtortrans.debtorno + WHERE debtortrans.transno='" . $_POST['BatchNo'] . "' + AND debtortrans.type=12"; + $CustRecs=DB_query($SQL,$db,'','',false,false); if (DB_error_no($db)!=0){ $title = _('Create PDF Print-out For A Batch Of Receipts'); @@ -99,13 +99,13 @@ exit; } $SQL = "SELECT narrative, - amount - FROM gltrans - WHERE gltrans.typeno='" . $_POST['BatchNo'] . "' - AND gltrans.type=12 and gltrans.amount <0 - AND gltrans.account !='" . $myrow['bankact'] . "' - AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'"; - + amount + FROM gltrans + WHERE gltrans.typeno='" . $_POST['BatchNo'] . "' + AND gltrans.type=12 and gltrans.amount <0 + AND gltrans.account !='" . $myrow['bankact'] . "' + AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'"; + $GLRecs=DB_query($SQL,$db,'','',false,false); if (DB_error_no($db)!=0){ $title = _('Create PDF Print-out For A Batch Of Receipts'); Modified: trunk/PDFOrderStatus.php =================================================================== --- trunk/PDFOrderStatus.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PDFOrderStatus.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -48,7 +48,7 @@ echo '<option selected value="All">' . _('Over All Categories') . '</option>'; while ($myrow=DB_fetch_array($result)){ - echo '<option value=' . $myrow['categoryid'] . '>' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } echo '</select></td></tr>'; Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PO_AuthorisationLevels.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -28,28 +28,27 @@ $_POST['AuthLevel']=0; } $sql="SELECT COUNT(*) - FROM purchorderauth - WHERE userid='" . $_POST['UserID'] . "' - AND currabrev='" . $_POST['CurrCode'] . "'"; + FROM purchorderauth + WHERE userid='" . $_POST['UserID'] . "' + AND currabrev='" . $_POST['CurrCode'] . "'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); if ($myrow[0]==0) { $sql="INSERT INTO purchorderauth ( userid, - currabrev, - cancreate, - offhold, - authlevel) - VALUES( - '".$_POST['UserID']."', - '".$_POST['CurrCode']."', - '".$CanCreate."', - '".$OffHold."', - '".$_POST['AuthLevel']."')"; - $ErrMsg = _('The authentication details cannot be inserted because'); - $Result=DB_query($sql,$db,$ErrMsg); + currabrev, + cancreate, + offhold, + authlevel) + VALUES( '".$_POST['UserID']."', + '".$_POST['CurrCode']."', + '".$CanCreate."', + '".$OffHold."', + '".$_POST['AuthLevel']."')"; + $ErrMsg = _('The authentication details cannot be inserted because'); + $Result=DB_query($sql,$db,$ErrMsg); } else { prnMsg(_('There already exists an entry for this user/currency combination'), 'error'); - echo '<br />'; + echo '<br />'; } } @@ -136,16 +135,16 @@ $OffHold=_('No'); } echo '<tr><td>' . $myrow['userid'] . '</td> - <td>' . $myrow['realname'] . '</td> - <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . - '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . - '&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> - </tr>'; + <td>' . $myrow['realname'] . '</td> + <td>' . $myrow['currency'] . '</td> + <td>' . $CanCreate . '</td> + <td>' . $OffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . +'&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . +'&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> + </tr>'; } echo '</table><br><br>'; @@ -176,7 +175,7 @@ $CurrencyResult=DB_query($CurrencySQL,$db); $myrow=DB_fetch_array($CurrencyResult); echo '<tr><td>'._('Currency').'</td> - <td>' . $myrow['currency'] . '</td></tr>'; + <td>' . $myrow['currency'] . '</td></tr>'; echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; Modified: trunk/SecurityTokens.php =================================================================== --- trunk/SecurityTokens.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/SecurityTokens.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -80,7 +80,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<br><table><tr>'; +echo '<br /><table><tr>'; if (isset($_GET['Action']) and $_GET['Action']=='edit') { echo '<td>'. _('Description') . '</td> @@ -99,7 +99,7 @@ echo '<table class="selection">'; echo '<tr><th>'. _('Token ID') .'</th> - <th>'. _('Description'). '</th>'; + <th>'. _('Description'). '</th>'; $sql="SELECT tokenid, tokenname FROM securitytokens ORDER BY tokenid"; $Result= DB_query($sql,$db); Modified: trunk/Shipt_Select.php =================================================================== --- trunk/Shipt_Select.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Shipt_Select.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -223,7 +223,7 @@ //figure out the SQL required from the inputs available - if (isset($ShiptRef) AND $ShiptRef !='') { + if (isset($ShiptRef) && $ShiptRef !="") { $SQL = "SELECT shipments.shiptref, vessel, voyageref, @@ -231,7 +231,7 @@ shipments.eta, shipments.closed FROM shipments INNER JOIN suppliers - ON shipments.supplierid = suppliers.supplierid + ON shipments.supplierid = suppliers.supplierid WHERE shipments.shiptref='". $ShiptRef . "'"; } else { $SQL = "SELECT DISTINCT shipments.shiptref, vessel, voyageref, suppliers.suppname, shipments.eta, shipments.closed @@ -250,17 +250,17 @@ AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } else { - $SQL .= " WHERE shipments.supplierid='" . $SelectedSupplier ."' + $SQL .= "WHERE shipments.supplierid='" . $SelectedSupplier ."' AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] ."'"; } } else { //no supplier selected if (isset($SelectedStockItem)) { - $SQL .= " WHERE purchorderdetails.itemcode='". $SelectedStockItem ."' + $SQL .= "WHERE purchorderdetails.itemcode='". $SelectedStockItem ."' AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } else { - $SQL .= " WHERE purchorders.intostocklocation = '". $_POST['StockLocation'] . "' + $SQL .= "WHERE purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Stocks.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -466,7 +466,7 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'StockMoves' - $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -475,7 +475,7 @@ echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('stock movements that refer to this item'); } else { - $sql= "SELECT COUNT(*) FROM bom WHERE component='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM bom WHERE component='".$StockID."' GROUP BY component"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -483,7 +483,7 @@ prnMsg( _('Cannot delete this item record because there are bills of material that require this part as a component'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('bills of material that require this part as a component'); } else { - $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='".$StockID."' GROUP BY stkcode"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -491,7 +491,7 @@ prnMsg( _('Cannot delete this item record because there are existing sales orders for this part'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales order items against this part'); } else { - $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -499,7 +499,7 @@ prnMsg(_('Cannot delete this item because sales analysis records exist for it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales analysis records against this part'); } else { - $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='".$StockID."' GROUP BY itemcode"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -507,7 +507,7 @@ prnMsg(_('Cannot delete this item because there are existing purchase order items for it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('purchase order item record relating to this part'); } else { - $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='".$StockID."'"; + $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]!=0) { Modified: trunk/SupplierAllocations.php =================================================================== --- trunk/SupplierAllocations.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/SupplierAllocations.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -294,21 +294,21 @@ $SQL= "SELECT systypes.typename, - supptrans.type, - supptrans.transno, - supptrans.trandate, - supptrans.supplierno, - suppliers.suppname, - rate, - (supptrans.ovamount+supptrans.ovgst) AS total, - supptrans.diffonexch, - supptrans.alloc - FROM supptrans, - systypes, - suppliers - WHERE supptrans.type = systypes.typeid - AND supptrans.supplierno = suppliers.supplierid - AND supptrans.id='" . $_SESSION['AllocTrans'] . "'"; + supptrans.type, + supptrans.transno, + supptrans.trandate, + supptrans.supplierno, + suppliers.suppname, + rate, + (supptrans.ovamount+supptrans.ovgst) AS total, + supptrans.diffonexch, + supptrans.alloc + FROM supptrans, + systypes, + suppliers + WHERE supptrans.type = systypes.typeid + AND supptrans.supplierno = suppliers.supplierid + AND supptrans.id='" . $_SESSION['AllocTrans'] . "'"; $Result = DB_query($SQL, $db); if (DB_num_rows($Result) != 1){ @@ -336,21 +336,21 @@ /*First get the transactions that have outstanding balances ie Total-Alloc >0 */ $SQL= "SELECT supptrans.id, - typename, - transno, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - diffonexch, - alloc - FROM supptrans, - systypes - WHERE supptrans.type = systypes.typeid - AND supptrans.settled=0 - AND abs(ovamount+ovgst-alloc)>0.009 - AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; - + typename, + transno, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + diffonexch, + alloc + FROM supptrans, + systypes + WHERE supptrans.type = systypes.typeid + AND supptrans.settled=0 + AND abs(ovamount+ovgst-alloc)>0.009 + AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; + $ErrMsg = _('There was a problem retrieving the transactions available to allocate to'); $DbgMsg = _('The SQL that was used to retrieve the transaction information was'); @@ -359,41 +359,41 @@ while ($myrow=DB_fetch_array($Result)){ $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], - $myrow['typename'], - $myrow['transno'], - ConvertSQLDate($myrow['trandate']), - $myrow['suppreference'], - 0, - $myrow['total'], - $myrow['rate'], - $myrow['diffonexch'], - $myrow['diffonexch'], - $myrow['alloc'], - 'NA'); - } + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), + $myrow['suppreference'], + 0, + $myrow['total'], + $myrow['rate'], + $myrow['diffonexch'], + $myrow['diffonexch'], + $myrow['alloc'], + 'NA'); +} /* Now get trans that might have previously been allocated to by this trans NB existing entries where still some of the trans outstanding entered from above logic will be overwritten with the prev alloc detail below */ $SQL = "SELECT supptrans.id, - typename, - transno, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - diffonexch, - supptrans.alloc-suppallocs.amt AS prevallocs, - amt, - suppallocs.id AS allocid - FROM supptrans, - systypes, - suppallocs - WHERE supptrans.type = systypes.typeid - AND supptrans.id=suppallocs.transid_allocto - AND suppallocs.transid_allocfrom='" . $_SESSION['AllocTrans'] . - "' AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; + typename, + transno, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + diffonexch, + supptrans.alloc-suppallocs.amt AS prevallocs, + amt, + suppallocs.id AS allocid + FROM supptrans, + systypes, + suppallocs + WHERE supptrans.type = systypes.typeid + AND supptrans.id=suppallocs.transid_allocto + AND suppallocs.transid_allocfrom='" . $_SESSION['AllocTrans'] . + "' AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; $ErrMsg = _('There was a problem retrieving the previously allocated transactions for modification'); @@ -405,14 +405,16 @@ $DiffOnExchThisOne = ($myrow['amt']/$myrow['rate']) - ($myrow['amt']/$_SESSION['Alloc']->TransExRate); - $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], $myrow['typename'], $myrow['transno'], - ConvertSQLDate($myrow['trandate']), $myrow['suppreference'], $myrow['amt'], - $myrow['total'], - $myrow['rate'], - $DiffOnExchThisOne, - ($myrow['diffonexch'] - $DiffOnExchThisOne), - $myrow['prevallocs'], - $myrow['allocid']); + $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), $myrow['suppreference'], $myrow['amt'], + $myrow['total'], + $myrow['rate'], + $DiffOnExchThisOne, + ($myrow['diffonexch'] - $DiffOnExchThisOne), + $myrow['prevallocs'], + $myrow['allocid']); } } @@ -444,12 +446,12 @@ echo '<table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Type') . '</th> - <th>' . _('Trans') . '<br />' . _('Number') . '</th> - <th>' . _('Trans') .'<br />' . _('Date') . '</th> - <th>' . _('Supp') . '<br />' . _('Ref') . '</th> - <th>' . _('Total') . '<br />' . _('Amount') .'</th> - <th>' . _('Yet to') . '<br />' . _('Allocate') . '</th> - <th>' . _('This') . '<br />' . _('Allocation') . '</th></tr>'; + <th>' . _('Trans') . '<br />' . _('Number') . '</th> + <th>' . _('Trans') .'<br />' . _('Date') . '</th> + <th>' . _('Supp') . '<br />' . _('Ref') . '</th> + <th>' . _('Total') . '<br />' . _('Amount') .'</th> + <th>' . _('Yet to') . '<br />' . _('Allocate') . '</th> + <th>' . _('This') . '<br />' . _('Allocation') . '</th></tr>'; $k = 0; $Counter = 0; $RowCounter = 0; @@ -481,11 +483,11 @@ $YetToAlloc = ($AllocnItem->TransAmount - $AllocnItem->PrevAlloc); echo '<td>' . $AllocnItem->TransType . '</td> - <td>' . $AllocnItem->TypeNo . '</td> - <td>' . $AllocnItem->TransDate . '</td> - <td>' . $AllocnItem->SuppRef . '</td> - <td class="number">' . number_format($AllocnItem->TransAmount,2) . '</td> - <td class="number">' . number_format($YetToAlloc,2) . '<input type="hidden" name="YetToAlloc' . + <td>' . $AllocnItem->TypeNo . '</td> + <td>' . $AllocnItem->TransDate . '</td> + <td>' . $AllocnItem->SuppRef . '</td> + <td class="number">' . number_format($AllocnItem->TransAmount,2) . '</td> + <td class="number">' . number_format($YetToAlloc,2) . '<input type="hidden" name="YetToAlloc' . $Counter . '" VALUE=' . $YetToAlloc . '></td>'; echo '<td class="number"><input type="checkbox" name="All' . $Counter . '"'; @@ -551,12 +553,12 @@ echo '<table class=selection>'; $TableHeader = '<tr><th>' . _('Trans Type') .'</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('To Alloc') . '</th> - </tr>\n'; + <th>' . _('Supplier') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('To Alloc') . '</th> + </tr>\n'; echo $TableHeader; @@ -587,7 +589,7 @@ ConvertSQLDate($myrow['trandate']), $myrow['total'], $myrow['total']-$myrow['alloc'], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow['id']); } @@ -600,35 +602,35 @@ unset($_SESSION['Alloc']); $sql = "SELECT id, - transno, - typename, - type, - suppliers.supplierid, - suppname, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - alloc - FROM supptrans, - suppliers, - systypes - WHERE supptrans.type=systypes.typeid - AND supptrans.supplierno=suppliers.supplierid - AND (type=21 or type=22) - AND settled=0 ORDER BY id"; + transno, + typename, + type, + suppliers.supplierid, + suppname, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + alloc + FROM supptrans, + suppliers, + systypes + WHERE supptrans.type=systypes.typeid + AND supptrans.supplierno=suppliers.supplierid + AND (type=21 or type=22) + AND settled=0 ORDER BY id"; $result = DB_query($sql, $db); echo '<table class=selection>'; $TableHeader = '<tr><th>' . _('Trans Type') . '</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('To Alloc') . '</th> - <th>' . _('More Info') . '</th> - </tr>' ; + <th>' . _('Supplier') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('To Alloc') . '</th> + <th>' . _('More Info') . '</th> + </tr>' ; echo $TableHeader; Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/UpgradeDatabase.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -98,6 +98,7 @@ case '3.10': $SQLScripts[] = './sql/mysql/upgrade3.10-3.11.sql'; case '3.11': + case '3.12.32': case '4.0RC1': case '4.01': case '4.02': @@ -195,4 +196,4 @@ } /*Dont do upgrade */ include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/Z_ImportStocks.php =================================================================== --- trunk/Z_ImportStocks.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Z_ImportStocks.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -1,308 +1,308 @@ -<?php -/* $Id: Z_ImportStocks.php 4043 2010-09-30 16:17:53Z tim_schofield $*/ -/* Script to make stock locations for all parts that do not have stock location records set up*/ - -//$PageSecurity = 15; -include('includes/session.inc'); -$title = _('Import Items'); -include('includes/header.inc'); - -// If this script is called with a file object, then the file contents are imported -// If this script is called with the gettemplate flag, then a template file is served -// Otherwise, a file upload form is displayed - -$headers = array( - 'StockID', // 0 'STOCKID', - 'Description', // 1 'DESCRIPTION', - 'LongDescription', // 2 'LONGDESCRIPTION', - 'CategoryID', // 3 'CATEGORYID', - 'Units', // 4 'UNITS', - 'MBFlag', // 5 'MBFLAG', - 'EOQ', // 6 'EOQ', - 'Discontinued', // 7 'DISCONTINUED', - 'Controlled', // 8 'CONTROLLED', - 'Serialised', // 9 'SERIALISED', - 'Perishable', // 10 'PERISHABLE', - 'Volume', // 11 'VOLUME', - 'KGS', // 12 'KGS', - 'BarCode', // 13 'BARCODE', - 'DiscountCategory', // 14 'DISCOUNTCATEGORY', - 'TaxCat', // 15 'TAXCAT', - 'DecimalPlaces', // 16 'DECIMALPLACES', - 'ItemPDF' // 17 'ITEMPDF' -); - -if ($_FILES['userfile']['name']) { //start file processing - - //initialize - $allowType='text/csv'; - $fieldTarget = 18; - $InputError = 0; - - //check file info - $fileName = $_FILES['userfile']['name']; - $tmpName = $_FILES['userfile']['tmp_name']; - $fileSize = $_FILES['userfile']['size']; - $fileType = $_FILES['userfile']['type']; - if ($fileType != $allowType) { - prnMsg (_('File has type '. $fileType. ', but only '. $allowType. ' is allowed.'),'error'); - include('includes/footer.inc'); - exit; - } - - //get file handle - $handle = fopen($tmpName, 'r'); - - //get the header row - $headRow = fgetcsv($handle, 10000, ","); - - //check for correct number of fields - if ( count($headRow) != count($headers) ) { - prnMsg (_('File contains '. count($headRow). ' columns, expected '. count($headers). '. Try downloading a new template.'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - - //test header row field name and sequence - $head = 0; - foreach ($headRow as $headField) { - if ( strtoupper($headField) != strtoupper($headers[$head]) ) { - prnMsg (_('File contains incorrect headers ('. strtoupper($headField). ' != '. strtoupper($header[$head]). '. Try downloading a new template.'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - $head++; - } - - //start database transaction - DB_Txn_Begin($db); - - //loop through file rows - $row = 1; - while ( ($myrow = fgetcsv($handle, 10000, ",")) !== FALSE ) { - - //check for correct number of fields - $fieldCount = count($myrow); - if ($fieldCount != $fieldTarget){ - prnMsg (_($fieldTarget. ' fields required, '. $fieldCount. ' fields received'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - - // cleanup the data (csv files often import with empty strings and such) - $StockID = strtoupper($myrow[0]); - foreach ($myrow as &$value) { - $value = trim($value); - } - - //first off check if the item already exists - $sql = "SELECT COUNT(stockid) FROM stockmaster WHERE stockid='".$StockID."'"; - $result = DB_query($sql,$db); - $testrow = DB_fetch_row($result); - if ($testrow[0] != 0) { - $InputError = 1; - prnMsg (_('Stock item "'. $StockID. '" already exists'),'error'); - } - - //next validate inputs are sensible - if (!$myrow[1] or strlen($myrow[1]) > 50 OR strlen($myrow[1])==0) { - $InputError = 1; - prnMsg (_('The stock item description must be entered and be fifty characters or less long') . '. ' . _('It cannot be a zero length string either') . ' - ' . _('a description is required'). ' ("'. implode('","',$myrow). $stockid. '") ','error'); - } - if (strlen($myrow[2])==0) { - $InputError = 1; - prnMsg (_('The stock item description cannot be a zero length string') . ' - ' . _('a long description is required'),'error'); - } - if (strlen($StockID) ==0) { - $InputError = 1; - prnMsg (_('The Stock Item code cannot be empty'),'error'); - } - if (strstr($StockID,' ') OR strstr($StockID,"'") OR strstr($StockID,'+') OR strstr($StockID,"\\") OR strstr($StockID,"\"") OR strstr($StockID,'&') OR strstr($StockID,'"')) { - $InputError = 1; - prnMsg(_('The stock item code cannot contain any of the following characters') . " ' & + \" \\ " . _('or a space'). " (". $StockID. ")",'error'); - $StockID=''; - } - if (strlen($myrow[4]) >20) { - $InputError = 1; - prnMsg(_('The unit of measure must be 20 characters or less long'),'error'); - } - if (strlen($myrow[13]) >20) { - $InputError = 1; - prnMsg(_('The barcode must be 20 characters or less long'),'error'); - } - if ($myrow[10]!=0 AND $myrow[10]!=1) { - $InputError = 1; - prnMsg (_('Values in the Perishable field must be either 0 (No) or 1 (Yes)') ,'error'); - } - if (!is_numeric($myrow[11])) { - $InputError = 1; - prnMsg (_('The volume of the packaged item in cubic metres must be numeric') ,'error'); - } - if ($myrow[11] <0) { - $InputError = 1; - prnMsg(_('The volume of the packaged item must be a positive number'),'error'); - } - if (!is_numeric($myrow[12])) { - $InputError = 1; - prnMsg(_('The weight of the packaged item in KGs must be numeric'),'error'); - } - if ($myrow[12]<0) { - $InputError = 1; - prnMsg(_('The weight of the packaged item must be a positive number'),'error'); - } - if (!is_numeric($myrow[6])) { - $InputError = 1; - prnMsg(_('The economic order quantity must be numeric'),'error'); - } - if ($$myrow[6] <0) { - $InputError = 1; - prnMsg (_('The economic order quantity must be a positive number'),'error'); - } - if ($myrow[8]==0 AND $myrow[9]==1){ - $InputError = 1; - prnMsg(_('The item can only be serialised if there is lot control enabled already') . '. ' . _('Batch control') . ' - ' . _('with any number of items in a lot/bundle/roll is enabled when controlled is enabled') . '. ' . _('Serialised control requires that only one item is in the batch') . '. ' . _('For serialised control') . ', ' . _('both controlled and serialised must be enabled'),'error'); - } - - $mbflag = $myrow[5]; - if ($mbflag!='M' and $mbflag!='K' and $mbflag!='A' and $mbflag!='B' and $mbflag!='D' and $mbflag!='G') { - $InputError = 1; - prnMsg(_('Items must be of MBFlag type Manufactured(M), Assembly(A), Kit-Set(K), Purchased(B), Dummy(D) or Phantom(G)'),'error'); - } - if (($mbflag=='A' OR $mbflag=='K' OR $mbflag=='D' OR $mbflag=='G') AND $myrow[8]==1){ - $InputError = 1; - prnMsg(_('Assembly/Kitset/Phantom/Service items cannot also be controlled items') . '. ' . _('Assemblies, Dummies and Kitsets are not physical items and batch/serial control is therefore not appropriate'),'error'); - } - if ($myrow[3]==''){ - $InputError = 1; - prnMsg(_('There are no inventory categories defined. All inventory items must belong to a valid inventory category,'),'error'); - } - if ($myrow[17]==''){ - $InputError = 1; - prnMsg(_('ItemPDF must contain either a filename, or the keyword `none`'),'error'); - } - - if ($InputError !=1){ - if ($myrow[9]==1){ /*Not appropriate to have several dp on serial items */ - $myrow[16]=0; - } - - //attempt ... [truncated message content] |
From: <dai...@us...> - 2011-05-11 09:59:52
|
Revision: 4563 http://web-erp.svn.sourceforge.net/web-erp/?rev=4563&view=rev Author: daintree Date: 2011-05-11 09:59:44 +0000 (Wed, 11 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/AccountSections.php trunk/Areas.php trunk/AuditTrail.php trunk/CustomerTypes.php trunk/FixedAssetItems.php trunk/FormDesigner.php trunk/GLJournal.php trunk/GLTags.php trunk/PDFBankingSummary.php trunk/PDFOrderStatus.php trunk/PO_AuthorisationLevels.php trunk/SecurityTokens.php trunk/Shipt_Select.php trunk/Stocks.php trunk/SupplierAllocations.php trunk/UpgradeDatabase.php trunk/Z_ImportStocks.php trunk/Z_MakeNewCompany.php trunk/doc/Change.log trunk/includes/session.inc Modified: trunk/AccountSections.php =================================================================== --- trunk/AccountSections.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/AccountSections.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -28,7 +28,7 @@ $myrow = DB_fetch_row($result); if( $myrow[0] == 0 ) { $sql = "INSERT INTO accountsection ( - sectionid, + sectionid,21 sectionname ) VALUES ( 2, @@ -68,9 +68,9 @@ $i++; } } - if (strpos($_POST['SectionName'],'&')>0 OR strpos($_POST['SectionName'],"'")>0) { + if (ContainsIllegalCharacters($_POST['SectionName'])>0) { $InputError = 1; - prnMsg( _('The account section name cannot contain the character') . " '&' " . _('or the character') ." '",'error'); + prnMsg( _('The account section name cannot contain any of the illegal characters') ." '",'error'); $Errors[$i] = 'SectionName'; $i++; } @@ -274,4 +274,4 @@ } //end if record deleted no point displaying form to add record include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Areas.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -138,16 +138,17 @@ if (!isset($SelectedArea)) { - $sql = 'SELECT * FROM areas'; + $sql = "SELECT * FROM areas"; $result = DB_query($sql,$db); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $title.'</p><br />'; - echo '<table>'; - echo "<tr> - <th>" . _('Area Code') . "</th> - <th>" . _('Area Name') . '</th>'; + echo '<table> + <tr> + <th>' . _('Area Code') . '</th> + <th>' . _('Area Name') . '</th> + </tr>'; $k=0; //row colour counter @@ -159,13 +160,11 @@ echo '<tr class="OddTableRows">'; $k++; } - - echo '<td>' . $myrow[0] . '</td>'; - echo '<td>' . $myrow[1] . '</td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . '&SelectedArea=' . $myrow[0] . '&delete=yes">' . _('Delete') . '</a></td>'; - echo '<td><a href="SelectCustomer.php'. '?' . SID . '&Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; - + echo '<td>' . $myrow[0] . '</td> + <td>' . $myrow[1] . '</td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '">' . _('Edit') . '</a></td>'; + echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedArea=' . $myrow[0] . '&delete=yes">' . _('Delete') . '</a></td>'; + echo '<td><a href="SelectCustomer.php'. '?Area=' . $myrow[0] . '">' . _('View Customers from this Area') . '</a></td>'; } //END WHILE LIST LOOP echo '</table>'; Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/AuditTrail.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -101,7 +101,8 @@ $SQLString = str_replace('SET','',$SQLString); $SQLString = str_replace('WHERE',',',$SQLString); $SQLString = str_replace('AND',',',$SQLString); - $FieldArray = preg_split("/[[:space:]]*([[:alnum:].]+[[:space:]]*=[[:space:]]*(?:'[^']*'|[[:digit:].]+))[[:space:]]*,/", $SQLString, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); for ($i=0; $i<sizeof($FieldArray); $i++) { + $FieldArray = preg_split("/[[:space:]]*([[:alnum:].]+[[:space:]]*=[[:space:]]*(?:'[^']*'|[[:digit:].]+))[[:space:]]*,/", $SQLString, 0, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); + for ($i=0; $i<sizeof($FieldArray); $i++) { $Assigment = explode('=', $FieldArray[$i]); $_SESSION['SQLString']['fields'][$i] = $Assigment[0]; if (sizeof($Assigment)>1) { @@ -176,7 +177,7 @@ if (isset($_SESSION['SQLString']['values'][$i]) and (trim(str_replace("'","",$_SESSION['SQLString']['values'][$i])) != "") & (trim($_SESSION['SQLString']['fields'][$i]) != 'password') & (trim($_SESSION['SQLString']['fields'][$i]) != "www_users.password")) { - echo '<tr bgcolor='.$RowColour.'>'; + echo '<tr bgcolor="' . $RowColour . '">'; echo '<td></td> <td></td> <td></td> @@ -186,7 +187,7 @@ echo '</tr>'; } } - echo '<tr bgcolor=black><td></td><td></td><td></td><td></td><td></td><td></td></tr>'; + echo '<tr bgcolor=black> <td colspan="6"></td> </tr>'; } unset($_SESSION['SQLString']); } Modified: trunk/CustomerTypes.php =================================================================== --- trunk/CustomerTypes.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/CustomerTypes.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -177,7 +177,7 @@ links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - $sql = 'SELECT typeid, typename FROM debtortype'; + $sql = "SELECT typeid, typename FROM debtortype"; $result = DB_query($sql,$db); echo '<br /><table class=selection>'; @@ -255,9 +255,11 @@ if (!isset($_POST['typename'])) { $_POST['typename']=''; } - echo '<tr><td>' . _('Type Name') . ':</td><td><input type="Text" name="typename" value="' . $_POST['typename'] . '"></td></tr>'; + echo '<tr><td>' . _('Type Name') . ':</td> + <td><input type="Text" name="typename" value="' . $_POST['typename'] . '"></td></tr>'; - echo '</td></tr></table>'; // close main table + echo '</td></tr> + </table>'; // close main table echo '<p><div class="centre"><input type=submit name=submit value="' . _('Accept') . '"></div>'; @@ -265,6 +267,5 @@ } // end if user wish to delete - include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/FixedAssetItems.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -130,9 +130,9 @@ $PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db); /* Get the new account codes for the new asset category */ $result = DB_query("SELECT costact, - accumdepnact - FROM fixedassetcategories - WHERE categoryid='" . $_POST['AssetCategoryID'] . "'",$db); + accumdepnact + FROM fixedassetcategories + WHERE categoryid='" . $_POST['AssetCategoryID'] . "'",$db); $NewAccounts = DB_fetch_array($result); $TransNo = GetNextTransNo( 42, $db); /* transaction type is asset category change */ @@ -145,7 +145,7 @@ account, narrative, amount) - VALUES ('42', + VALUES ('42', '" . $TransNo . "', '" . Date('Y-m-d') . "', '" . $PeriodNo . "', @@ -159,75 +159,75 @@ //debit cost for the new category $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) + typeno, + trandate, + periodno, + account, + narrative, + amount) VALUES ('42', - '" . $TransNo . "', - '" . Date('Y-m-d') . "', - '" . $PeriodNo . "', - '" . $NewAccounts['costact'] . "', - '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', - '" . $OldDetails['cost']. "' - )"; + '" . $TransNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $NewAccounts['costact'] . "', + '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', + '" . $OldDetails['cost']. "' + )"; $ErrMsg = _('Cannot insert a GL entry for the change of asset category because'); $DbgMsg = _('The SQL that failed to insert the cost GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); if ($OldDetails['accumdepn']!=0) { //debit accumdepn for the old category $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ('42', - '" . $TransNo . "', - '" . Date('Y-m-d') . "', - '" . $PeriodNo . "', - '" . $OldDetails['accumdepnact'] . "', - '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', - '" . $OldDetails['accumdepn']. "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ('42', + '" . $TransNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $OldDetails['accumdepnact'] . "', + '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', + '" . $OldDetails['accumdepn']. "' + )"; $ErrMsg = _('Cannot insert a GL entry for the change of asset category because'); $DbgMsg = _('The SQL that failed to insert the cost GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); //credit accum depn for the new category $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ('42', - '" . $TransNo . "', - '" . Date('Y-m-d') . "', - '" . $PeriodNo . "', - '" . $NewAccounts['accumdepnact'] . "', - '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', - '" . $OldDetails['accumdepn']. "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ('42', + '" . $TransNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $NewAccounts['accumdepnact'] . "', + '" . $AssetID . ' ' . _('change category') . ' ' . $OldDetails['assetcategoryid'] . ' - ' . $_POST['AssetCategoryID'] . "', + '" . $OldDetails['accumdepn']. "' + )"; $ErrMsg = _('Cannot insert a GL entry for the change of asset category because'); $DbgMsg = _('The SQL that failed to insert the cost GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); } /*end if there was accumulated depreciation for the asset */ } /* end if there is a change in asset category */ $sql = "UPDATE fixedassets - SET longdescription='" . $_POST['LongDescription'] . "', - description='" . $_POST['Description'] . "', - assetcategoryid='" . $_POST['AssetCategoryID'] . "', - assetlocation='" . $_POST['AssetLocation'] . "', - depntype='" . $_POST['DepnType'] . "', - depnrate='" . $_POST['DepnRate'] . "', - barcode='" . $_POST['BarCode'] . "', - serialno='" . $_POST['SerialNo'] . "' - WHERE assetid='" . $AssetID . "'"; + SET longdescription='" . $_POST['LongDescription'] . "', + description='" . $_POST['Description'] . "', + assetcategoryid='" . $_POST['AssetCategoryID'] . "', + assetlocation='" . $_POST['AssetLocation'] . "', + depntype='" . $_POST['DepnType'] . "', + depnrate='" . $_POST['DepnRate'] . "', + barcode='" . $_POST['BarCode'] . "', + serialno='" . $_POST['SerialNo'] . "' + WHERE assetid='" . $AssetID . "'"; $ErrMsg = _('The asset could not be updated because'); $DbgMsg = _('The SQL that was used to update the asset and failed was'); @@ -237,22 +237,22 @@ echo '<br />'; } else { //it is a NEW part $sql = "INSERT INTO fixedassets (description, - longdescription, - assetcategoryid, - assetlocation, - depntype, - depnrate, - barcode, - serialno) - VALUES ( - '" . $_POST['Description'] . "', - '" . $_POST['LongDescription'] . "', - '" . $_POST['AssetCategoryID'] . "', - '" . $_POST['AssetLocation'] . "', - '" . $_POST['DepnType'] . "', - '" . $_POST['DepnRate']. "', - '" . $_POST['BarCode'] . "', - '" . $_POST['SerialNo'] . "' )"; + longdescription, + assetcategoryid, + assetlocation, + depntype, + depnrate, + barcode, + serialno) + VALUES ( + '" . $_POST['Description'] . "', + '" . $_POST['LongDescription'] . "', + '" . $_POST['AssetCategoryID'] . "', + '" . $_POST['AssetLocation'] . "', + '" . $_POST['DepnType'] . "', + '" . $_POST['DepnRate']. "', + '" . $_POST['BarCode'] . "', + '" . $_POST['SerialNo'] . "' )"; $ErrMsg = _('The asset could not be added because'); $DbgMsg = _('The SQL that was used to add the asset failed was'); $result = DB_query($sql,$db, $ErrMsg, $DbgMsg); @@ -278,12 +278,12 @@ $CancelDelete = 0; //what validation is required before allowing deletion of assets .... maybe there should be no deletion option? $result = DB_query("SELECT cost, - accumdepn, - accumdepnact, - costact - FROM fixedassets INNER JOIN fixedassetcategories - ON fixedassets.assetcategoryid=fixedassetcategories.categoryid - WHERE assetid='" . $AssetID . "'", $db); + accumdepn, + accumdepnact, + costact + FROM fixedassets INNER JOIN fixedassetcategories + ON fixedassets.assetcategoryid=fixedassetcategories.categoryid + WHERE assetid='" . $AssetID . "'", $db); $AssetRow = DB_fetch_array($result); $NBV = $AssetRow['cost'] -$AssetRow['accumdepn']; if ($NBV!=0) { @@ -309,40 +309,40 @@ if ($AssetRow['cost'] > 0){ //credit cost for the asset deleted $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ('43', - '" . $TransNo . "', - '" . Date('Y-m-d') . "', - '" . $PeriodNo . "', - '" . $AssetRow['costact'] . "', - '" . _('Delete asset') . ' ' . $AssetID . "', - '" . -$AssetRow['cost']. "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ('43', + '" . $TransNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $AssetRow['costact'] . "', + '" . _('Delete asset') . ' ' . $AssetID . "', + '" . -$AssetRow['cost']. "' + )"; $ErrMsg = _('Cannot insert a GL entry for the deletion of the asset because'); $DbgMsg = _('The SQL that failed to insert the cost GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); //debit accumdepn for the depreciation removed on deletion of this asset $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) - VALUES ('43', - '" . $TransNo . "', - '" . Date('Y-m-d') . "', - '" . $PeriodNo . "', - '" . $AssetRow['accumdepnact'] . "', - '" . _('Delete asset') . ' ' . $AssetID . "', - '" . $Asset['accumdepn']. "' - )"; + typeno, + trandate, + periodno, + account, + narrative, + amount) + VALUES ('43', + '" . $TransNo . "', + '" . Date('Y-m-d') . "', + '" . $PeriodNo . "', + '" . $AssetRow['accumdepnact'] . "', + '" . _('Delete asset') . ' ' . $AssetID . "', + '" . $Asset['accumdepn']. "' + )"; $ErrMsg = _('Cannot insert a GL entry for the reversal of accumulated depreciation on deletion of the asset because'); $DbgMsg = _('The SQL that failed to insert the cost GL Trans record was'); $result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true); @@ -394,17 +394,17 @@ } elseif ($InputError!=1) { // Must be modifying an existing item and no changes made yet - need to lookup the details $sql = "SELECT assetid, - description, - longdescription, - assetcategoryid, - serialno, - assetlocation, - datepurchased, - depntype, - depnrate, - cost, - accumdepn, - barcode + description, + longdescription, + assetcategoryid, + serialno, + assetlocation, + datepurchased, + depntype, + depnrate, + cost, + accumdepn, + barcode FROM fixedassets WHERE assetid ='" . $AssetID . "'"; @@ -421,11 +421,11 @@ $_POST['DepnRate'] = $AssetRow['depnrate']; echo '<tr><td>' . _('Asset Code') . ':</td><td>'.$AssetID.'</td></tr>'. "\n"; - echo '<input type="Hidden" name="AssetID" value='.$AssetID.'>'. "\n"; + echo '<input type="Hidden" name="AssetID" value="'.$AssetID.'"/>'. "\n"; } else { // some changes were made to the data so don't re-set form variables to DB ie the code above echo '<tr><td>' . _('Asset Code') . ':</td><td>' . $AssetID . '</td></tr>'; - echo '<input type="Hidden" name="AssetID" value="' . $AssetID . '">'; + echo '<input type="Hidden" name="AssetID" value="' . $AssetID . '"/>'; } if (isset($_POST['Description'])) { @@ -434,7 +434,7 @@ $Description =''; } echo '<tr><td>' . _('Asset Description') . ' (' . _('short') . '):</td> - <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Description" size=52 maxlength=50 value="' . $Description . '"></td></tr>'."\n"; + <td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Description" size=52 maxlength=50 value="' . $Description . '"></td></tr>'."\n"; if (isset($_POST['LongDescription'])) { $LongDescription = AddCarriageReturns($_POST['LongDescription']); Modified: trunk/FormDesigner.php =================================================================== --- trunk/FormDesigner.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/FormDesigner.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -1,6 +1,6 @@ <?php /* $Id$ */ -//$PageSecurity = 14; + include('includes/session.inc'); $title = _('Form Designer'); include('includes/header.inc'); @@ -108,9 +108,6 @@ case 'GoodsReceived.xml': echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PDFGrn.php?' . SID .'GRNNo=Preview&PONo=1">'; break; - case 'SalesInvoice.xml': - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PrintCustTrans.php?' . SID .'FromTransNo=Preview&InvOrCredit=Invoice&PrintPDF=True">'; - break; case 'PickingList.xml': echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/PDFPickingList.php?' . SID .'TransNo=Preview">'; break; Modified: trunk/GLJournal.php =================================================================== --- trunk/GLJournal.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/GLJournal.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -22,7 +22,7 @@ Journals cannot be entered against bank accounts GL postings involving bank accounts must be done using a receipt or a payment transaction to ensure a bank trans is available for matching off vs statements */ - $SQL = 'SELECT accountcode FROM bankaccounts'; + $SQL = "SELECT accountcode FROM bankaccounts"; $result = DB_query($SQL,$db); $i=0; while ($Act = DB_fetch_row($result)){ @@ -158,8 +158,8 @@ if ($AllowThisPosting) { $SQL = "SELECT accountname - FROM chartmaster - WHERE accountcode='" . $_POST['GLManualCode'] . "'"; + FROM chartmaster + WHERE accountcode='" . $_POST['GLManualCode'] . "'"; $Result=DB_query($SQL,$db); if (DB_num_rows($Result)==0){ @@ -270,13 +270,13 @@ //Select the tag echo '<tr><td><select name="tag">'; -$SQL = 'SELECT tagref, - tagdescription +$SQL = "SELECT tagref, + tagdescription FROM tags - ORDER BY tagref'; + ORDER BY tagref"; $result=DB_query($SQL,$db); -echo '<option value="0">0 - None</option>'; +echo '<option value="0">0 - ' . _('None') . '</option>'; while ($myrow=DB_fetch_array($result)){ if (isset($_POST['tag']) and $_POST['tag']==$myrow['tagref']){ echo '<option selected value="' . $myrow['tagref'] . '">' . $myrow['tagref'].' - ' .$myrow['tagdescription'].'</option>'; @@ -294,10 +294,10 @@ "'".'The account code '."'".'+ this.value+ '."'".' doesnt exist'."'".')"' . ' value="'. $_POST['GLManualCode'] .'" /></td>'; -$sql='SELECT accountcode, - accountname - FROM chartmaster - ORDER BY accountcode'; +$sql="SELECT accountcode, + accountname + FROM chartmaster + ORDER BY accountcode"; $result=DB_query($sql, $db); echo '<td><select name="GLCode" onChange="return assignComboToInput(this,'.'GLManualCode'.')">'; @@ -321,7 +321,7 @@ $_POST['Debit'] = ''; } -echo '</tr><tr><th>' . _('Debit') . '</th>'.'<td><input type="text" class="number" Name = "Debit" ' . +echo '</tr><tr><th>' . _('Debit') . '</th><td><input type="text" class="number" name = "Debit" ' . 'onChange="eitherOr(this, '.'Credit'.')"'. ' Maxlength="12" size="10" value="' . $_POST['Debit'] . '" /></td>'; echo '</tr><tr><th>' . _('Credit') . '</th><td><input type="text" class="number" Name = "Credit" ' . @@ -333,21 +333,22 @@ echo '<td><input type="text" name="GLNarrative" maxlength="100" size="100" value="' . $_POST['GLNarrative'] . '" /></td>'; echo '</tr></table><br />'; /*Close the main table */ -echo "<div class='centre'><input type='submit' name='Process' value='" . _('Accept') . "' /></div><br /><br />"; +echo '<div class="centre"><input type="submi2t" name="Process" value="' . _('Accept') . '" /></div><br /><br />'; echo '<table class="selection" width="85%">'; echo '<tr><th colspan="6"><div class="centre"><font size="3" color="blue"><b>' . _('Journal Summary') . '</b></font></div></th></tr>'; echo '<tr> - <th>'._('GL Tag').'</th> - <th>'._('GL Account').'</th> - <th>'._('Debit').'</th> - <th>'._('Credit').'</th> - <th>'._('Narrative').'</th></tr>'; + <th>'._('GL Tag').'</th> + <th>'._('GL Account').'</th> + <th>'._('Debit').'</th> + <th>'._('Credit').'</th> + <th>'._('Narrative').'</th> + </tr>'; -$debittotal=0; -$credittotal=0; +$DebitTotal=0; +$CreditTotal=0; $j=0; foreach ($_SESSION['JournalDetail']->GLEntries as $JournalItem) { @@ -364,39 +365,38 @@ $result=DB_query($sql, $db); $myrow=DB_fetch_row($result); if ($JournalItem->tag==0) { - $tagdescription='None'; + $TagDescription=_('None'); } else { - $tagdescription=$myrow[0]; + $TagDescription=$myrow[0]; } - echo '<td>' . $JournalItem->tag . ' - ' . $tagdescription . '</td>'; + echo '<td>' . $JournalItem->tag . ' - ' . $TagDescription . '</td>'; echo '<td>' . $JournalItem->GLCode . ' - ' . $JournalItem->GLActName . '</td>'; if ($JournalItem->Amount>0) { - echo '<td class="number">' . number_format($JournalItem->Amount,2) . '</td><td></td>'; - $debittotal=$debittotal+$JournalItem->Amount; - + echo '<td class="number">' . number_format($JournalItem->Amount,$_SESSION['CompanyRecord']['decimalplaces']) . '</td><td></td>'; + $DebitTotal=$DebitTotal+$JournalItem->Amount; } elseif($JournalItem->Amount<0) { - $credit=(-1 * $JournalItem->Amount); + $Credit=(-1 * $JournalItem->Amount); echo '<td></td> - <td class="number">' . number_format($credit,2) . '</td>'; - $credittotal=$credittotal+$credit; + <td class="number">' . number_format($Credit,$_SESSION['CompanyRecord']['decimalplaces']) . '</td>'; + $CreditTotal=$CreditTotal+$Credit; } - echo '<td>' . $JournalItem->Narrative . "</td> - <td><a href='" . $_SERVER['PHP_SELF'] . '?Delete=' . $JournalItem->ID . "'>"._('Delete').'</a></td> + echo '<td>' . $JournalItem->Narrative . '</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $JournalItem->ID . '">' . _('Delete').'</a></td> </tr>'; } echo '<tr class="EvenTableRows"><td></td> - <td class="number"><b>' . _('Total') . '</b></td> - <td class="number"><b>' . number_format($debittotal,2) . '</b></td> - <td class="number"><b>' . number_format($credittotal,2) . '</b></td></tr>'; -if ($debittotal!=$credittotal) { + <td class="number"><b>' . _('Total') . '</b></td> + <td class="number"><b>' . number_format($DebitTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> + <td class="number"><b>' . number_format($CreditTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td></tr>'; +if ($DebitTotal!=$CreditTotal) { echo '<td align="center" style="background-color: #fddbdb"><b>' . _('Required to balance') .' - </b>' . - number_format(abs($debittotal-$credittotal),2); + number_format(abs($DebitTotal-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']); } -if ($debittotal>$credittotal) { +if ($DebitTotal>$CreditTotal) { echo ' ' . _('Credit') . '</td></tr>'; -} else if ($debittotal<$credittotal) { +} else if ($DebitTotal<$CreditTotal) { echo ' ' . _('Debit') . '</td></tr>'; } echo '</table>'; @@ -409,9 +409,9 @@ } if (!isset($_GET['NewJournal']) or $_GET['NewJournal']=='') { - echo "<script>defaultControl(document.form.GLManualCode);</script>"; + echo '<script>defaultControl(document.form.GLManualCode);</script>'; } else { - echo "<script>defaultControl(document.form.JournalProcessDate);</script>"; + echo '<script>defaultControl(document.form.JournalProcessDate);</script>'; } echo '</form>'; Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/GLTags.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -8,39 +8,57 @@ include('includes/header.inc'); if (isset($_GET['SelectedTag'])) { - $sql="SELECT tagref, tagdescription FROM tags where tagref='".$_GET['SelectedTag']."'"; - $result= DB_query($sql,$db); - $myrow = DB_fetch_array($result,$db); - $ref=$myrow[0]; - $description=$myrow[1]; + if($_GET['Action']=='delete'){ + //first off test there are no transactions created with this tag + $Result = DB_query("SELECT counterindex + FROM gltrans + WHERE tag='" . $_GET['SelectedTag'] . "'",$db); + if (DB_num_rows($Result)>0){ + prnMsg(_('This tag cannot be deleted since there are already general ledger transactions created using it.'),'error'); + } else { + $Result = DB_query("DELETE FROM tags WHERE tagref='" . $_GET['SelectedTag'] . "'",$db); + prnMsg(_('The selected tag has been deleted'),'success'); + } + } else { + $sql="SELECT tagref, + tagdescription + FROM tags + WHERE tagref='".$_GET['SelectedTag']."'"; + + $result= DB_query($sql,$db); + $myrow = DB_fetch_array($result,$db); + $ref=$myrow['tagref']; + $Description=$myrow['tagdescription']; + } } else { - $description=''; + $Description=''; $_GET['SelectedTag']=''; } if (isset($_POST['submit'])) { - $sql = "INSERT INTO tags values(NULL, '".$_POST['description']."')"; + $sql = "INSERT INTO tags values(NULL, '".$_POST['Description']."')"; $result= DB_query($sql,$db); } if (isset($_POST['update'])) { - $sql = "UPDATE tags SET tagdescription='".$_POST['description']. - "' WHERE tagref='".$_POST['reference']."'"; + $sql = "UPDATE tags SET tagdescription='".$_POST['Description']. "' + WHERE tagref='".$_POST['reference']."'"; $result= DB_query($sql,$db); } echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/maintenance.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; -echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . ' name="form">'; +echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<br><table><tr>'; +echo '<br /> + <table><tr>'; echo '<td>'. _('Description') . '</td> - <td><input type="text" size=30 maxlength=30 name="description" value="'.$description.'"></td><td> - <input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; + <td><input type="text" size=30 maxlength=30 name="Description" value="'.$Description.'"></td><td> + <input type="hidden" name="reference" value="'.$_GET['SelectedTag'].'">'; -if (isset($_GET['Action']) and $_GET['Action']=='edit') { +if (isset($_GET['Action']) AND $_GET['Action']=='edit') { echo '<input type="submit" name=update value=' . _('Update') . '>'; } else { echo '<input type="submit" name=submit value=' . _('Insert') . '>'; @@ -50,21 +68,25 @@ echo '</form>'; -echo '<table class=selection>'; -echo '<tr><th>'. _('Tag ID') .'</th>'; -echo '<th>'. _('Description'). '</th>'; +echo '<table class="selection">'; +echo '<tr><th>'. _('Tag ID') .'</th> + <th>'. _('Description'). '</th> + </tr>'; $sql="SELECT tagref, tagdescription FROM tags order by tagref"; $result= DB_query($sql,$db); while ($myrow = DB_fetch_array($result,$db)){ - echo '<tr><td>'.$myrow[0].'</td><td>'.$myrow[1].'</td> - <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow[0] . '&Action=edit">' . _('Edit') . '</a></td></tr>'; + echo '<tr><td>' . $myrow['tagref'].'</td> + <td>' . $myrow['tagdescription'].'</td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=edit">' . _('Edit') . '</a></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?SelectedTag=' . $myrow['tagref'] . '&Action=delete">' . _('Delete') . '</a></td> + </tr>'; } echo '</table><p></p>'; -echo '<script>defaultControl(document.form.description);</script>'; +echo '<script>defaultControl(document.form.Description);</script>'; include('includes/footer.inc'); Modified: trunk/PDFBankingSummary.php =================================================================== --- trunk/PDFBankingSummary.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PDFBankingSummary.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -25,7 +25,7 @@ $result=DB_query($sql, $db); echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> - <table class=selection>'; + <table class="selection">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<tr><td>' . _('Select the batch number of receipts to be printed') . ':</td>'; echo '<td><select name="BatchNo">'; @@ -41,19 +41,19 @@ if (isset($_POST['BatchNo']) and $_POST['BatchNo']!='') { $SQL= "SELECT bankaccountname, - bankaccountnumber, - ref, - transdate, - banktranstype, - bankact, - banktrans.exrate, - banktrans.functionalexrate, - banktrans.currcode - FROM bankaccounts, - banktrans - WHERE bankaccounts.accountcode=banktrans.bankact - AND banktrans.transno='" . $_POST['BatchNo'] . "' - AND banktrans.type=12"; + bankaccountnumber, + ref, + transdate, + banktranstype, + bankact, + banktrans.exrate, + banktrans.functionalexrate, + banktrans.currcode + FROM bankaccounts, + banktrans + WHERE bankaccounts.accountcode=banktrans.bankact + AND banktrans.transno='" . $_POST['BatchNo'] . "' + AND banktrans.type=12"; $ErrMsg = _('An error occurred getting the header information about the receipt batch number') . ' ' . $_POST['BatchNo']; $DbgMsg = _('The SQL used to get the receipt header information that failed was'); @@ -79,14 +79,14 @@ $SQL = "SELECT debtorsmaster.name, - ovamount, - invtext, - reference - FROM debtorsmaster INNER JOIN debtortrans - ON debtorsmaster.debtorno=debtortrans.debtorno - WHERE debtortrans.transno='" . $_POST['BatchNo'] . "' - AND debtortrans.type=12"; - + ovamount, + invtext, + reference + FROM debtorsmaster INNER JOIN debtortrans + ON debtorsmaster.debtorno=debtortrans.debtorno + WHERE debtortrans.transno='" . $_POST['BatchNo'] . "' + AND debtortrans.type=12"; + $CustRecs=DB_query($SQL,$db,'','',false,false); if (DB_error_no($db)!=0){ $title = _('Create PDF Print-out For A Batch Of Receipts'); @@ -99,13 +99,13 @@ exit; } $SQL = "SELECT narrative, - amount - FROM gltrans - WHERE gltrans.typeno='" . $_POST['BatchNo'] . "' - AND gltrans.type=12 and gltrans.amount <0 - AND gltrans.account !='" . $myrow['bankact'] . "' - AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'"; - + amount + FROM gltrans + WHERE gltrans.typeno='" . $_POST['BatchNo'] . "' + AND gltrans.type=12 and gltrans.amount <0 + AND gltrans.account !='" . $myrow['bankact'] . "' + AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'"; + $GLRecs=DB_query($SQL,$db,'','',false,false); if (DB_error_no($db)!=0){ $title = _('Create PDF Print-out For A Batch Of Receipts'); Modified: trunk/PDFOrderStatus.php =================================================================== --- trunk/PDFOrderStatus.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PDFOrderStatus.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -48,7 +48,7 @@ echo '<option selected value="All">' . _('Over All Categories') . '</option>'; while ($myrow=DB_fetch_array($result)){ - echo '<option value=' . $myrow['categoryid'] . '>' . $myrow['categorydescription'] . '</option>'; + echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } echo '</select></td></tr>'; Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/PO_AuthorisationLevels.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -28,28 +28,27 @@ $_POST['AuthLevel']=0; } $sql="SELECT COUNT(*) - FROM purchorderauth - WHERE userid='" . $_POST['UserID'] . "' - AND currabrev='" . $_POST['CurrCode'] . "'"; + FROM purchorderauth + WHERE userid='" . $_POST['UserID'] . "' + AND currabrev='" . $_POST['CurrCode'] . "'"; $result=DB_query($sql, $db); $myrow=DB_fetch_array($result); if ($myrow[0]==0) { $sql="INSERT INTO purchorderauth ( userid, - currabrev, - cancreate, - offhold, - authlevel) - VALUES( - '".$_POST['UserID']."', - '".$_POST['CurrCode']."', - '".$CanCreate."', - '".$OffHold."', - '".$_POST['AuthLevel']."')"; - $ErrMsg = _('The authentication details cannot be inserted because'); - $Result=DB_query($sql,$db,$ErrMsg); + currabrev, + cancreate, + offhold, + authlevel) + VALUES( '".$_POST['UserID']."', + '".$_POST['CurrCode']."', + '".$CanCreate."', + '".$OffHold."', + '".$_POST['AuthLevel']."')"; + $ErrMsg = _('The authentication details cannot be inserted because'); + $Result=DB_query($sql,$db,$ErrMsg); } else { prnMsg(_('There already exists an entry for this user/currency combination'), 'error'); - echo '<br />'; + echo '<br />'; } } @@ -136,16 +135,16 @@ $OffHold=_('No'); } echo '<tr><td>' . $myrow['userid'] . '</td> - <td>' . $myrow['realname'] . '</td> - <td>' . $myrow['currency'] . '</td> - <td>' . $CanCreate . '</td> - <td>' . $OffHold . '</td> - <td class="number">'.number_format($myrow['authlevel'],2).'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . - '&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> - <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . - '&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> - </tr>'; + <td>' . $myrow['realname'] . '</td> + <td>' . $myrow['currency'] . '</td> + <td>' . $CanCreate . '</td> + <td>' . $OffHold . '</td> + <td class="number">'.number_format($myrow['authlevel'],2).'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Edit=Yes&UserID=' . $myrow['userid'] . +'&Currency='.$myrow['currabrev'].'">'._('Edit').'</td> + <td><a href="'.$rootpath.'/PO_AuthorisationLevels.php?Delete=Yes&UserID=' . $myrow['userid'] . +'&Currency='.$myrow['currabrev'].'">'._('Delete').'</td> + </tr>'; } echo '</table><br><br>'; @@ -176,7 +175,7 @@ $CurrencyResult=DB_query($CurrencySQL,$db); $myrow=DB_fetch_array($CurrencyResult); echo '<tr><td>'._('Currency').'</td> - <td>' . $myrow['currency'] . '</td></tr>'; + <td>' . $myrow['currency'] . '</td></tr>'; echo '<input type=hidden name="currabrev" value="'.$Currency.'"'; } else { echo '<tr><td>'._('Currency').'</td><td><select name="CurrCode">'; Modified: trunk/SecurityTokens.php =================================================================== --- trunk/SecurityTokens.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/SecurityTokens.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -80,7 +80,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '" name="form">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -echo '<br><table><tr>'; +echo '<br /><table><tr>'; if (isset($_GET['Action']) and $_GET['Action']=='edit') { echo '<td>'. _('Description') . '</td> @@ -99,7 +99,7 @@ echo '<table class="selection">'; echo '<tr><th>'. _('Token ID') .'</th> - <th>'. _('Description'). '</th>'; + <th>'. _('Description'). '</th>'; $sql="SELECT tokenid, tokenname FROM securitytokens ORDER BY tokenid"; $Result= DB_query($sql,$db); Modified: trunk/Shipt_Select.php =================================================================== --- trunk/Shipt_Select.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Shipt_Select.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -223,7 +223,7 @@ //figure out the SQL required from the inputs available - if (isset($ShiptRef) AND $ShiptRef !='') { + if (isset($ShiptRef) && $ShiptRef !="") { $SQL = "SELECT shipments.shiptref, vessel, voyageref, @@ -231,7 +231,7 @@ shipments.eta, shipments.closed FROM shipments INNER JOIN suppliers - ON shipments.supplierid = suppliers.supplierid + ON shipments.supplierid = suppliers.supplierid WHERE shipments.shiptref='". $ShiptRef . "'"; } else { $SQL = "SELECT DISTINCT shipments.shiptref, vessel, voyageref, suppliers.suppname, shipments.eta, shipments.closed @@ -250,17 +250,17 @@ AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } else { - $SQL .= " WHERE shipments.supplierid='" . $SelectedSupplier ."' + $SQL .= "WHERE shipments.supplierid='" . $SelectedSupplier ."' AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] ."'"; } } else { //no supplier selected if (isset($SelectedStockItem)) { - $SQL .= " WHERE purchorderdetails.itemcode='". $SelectedStockItem ."' + $SQL .= "WHERE purchorderdetails.itemcode='". $SelectedStockItem ."' AND purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } else { - $SQL .= " WHERE purchorders.intostocklocation = '". $_POST['StockLocation'] . "' + $SQL .= "WHERE purchorders.intostocklocation = '". $_POST['StockLocation'] . "' AND shipments.closed='" . $_POST['OpenOrClosed'] . "'"; } Modified: trunk/Stocks.php =================================================================== --- trunk/Stocks.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Stocks.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -466,7 +466,7 @@ // PREVENT DELETES IF DEPENDENT RECORDS IN 'StockMoves' - $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -475,7 +475,7 @@ echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('stock movements that refer to this item'); } else { - $sql= "SELECT COUNT(*) FROM bom WHERE component='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM bom WHERE component='".$StockID."' GROUP BY component"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -483,7 +483,7 @@ prnMsg( _('Cannot delete this item record because there are bills of material that require this part as a component'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('bills of material that require this part as a component'); } else { - $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='".$StockID."' GROUP BY stkcode"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -491,7 +491,7 @@ prnMsg( _('Cannot delete this item record because there are existing sales orders for this part'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales order items against this part'); } else { - $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -499,7 +499,7 @@ prnMsg(_('Cannot delete this item because sales analysis records exist for it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales analysis records against this part'); } else { - $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='".$StockID."'"; + $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='".$StockID."' GROUP BY itemcode"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]>0) { @@ -507,7 +507,7 @@ prnMsg(_('Cannot delete this item because there are existing purchase order items for it'),'warn'); echo '<br />' . _('There are') . ' ' . $myrow[0] . ' ' . _('purchase order item record relating to this part'); } else { - $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='".$StockID."'"; + $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='".$StockID."' GROUP BY stockid"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); if ($myrow[0]!=0) { Modified: trunk/SupplierAllocations.php =================================================================== --- trunk/SupplierAllocations.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/SupplierAllocations.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -294,21 +294,21 @@ $SQL= "SELECT systypes.typename, - supptrans.type, - supptrans.transno, - supptrans.trandate, - supptrans.supplierno, - suppliers.suppname, - rate, - (supptrans.ovamount+supptrans.ovgst) AS total, - supptrans.diffonexch, - supptrans.alloc - FROM supptrans, - systypes, - suppliers - WHERE supptrans.type = systypes.typeid - AND supptrans.supplierno = suppliers.supplierid - AND supptrans.id='" . $_SESSION['AllocTrans'] . "'"; + supptrans.type, + supptrans.transno, + supptrans.trandate, + supptrans.supplierno, + suppliers.suppname, + rate, + (supptrans.ovamount+supptrans.ovgst) AS total, + supptrans.diffonexch, + supptrans.alloc + FROM supptrans, + systypes, + suppliers + WHERE supptrans.type = systypes.typeid + AND supptrans.supplierno = suppliers.supplierid + AND supptrans.id='" . $_SESSION['AllocTrans'] . "'"; $Result = DB_query($SQL, $db); if (DB_num_rows($Result) != 1){ @@ -336,21 +336,21 @@ /*First get the transactions that have outstanding balances ie Total-Alloc >0 */ $SQL= "SELECT supptrans.id, - typename, - transno, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - diffonexch, - alloc - FROM supptrans, - systypes - WHERE supptrans.type = systypes.typeid - AND supptrans.settled=0 - AND abs(ovamount+ovgst-alloc)>0.009 - AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; - + typename, + transno, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + diffonexch, + alloc + FROM supptrans, + systypes + WHERE supptrans.type = systypes.typeid + AND supptrans.settled=0 + AND abs(ovamount+ovgst-alloc)>0.009 + AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; + $ErrMsg = _('There was a problem retrieving the transactions available to allocate to'); $DbgMsg = _('The SQL that was used to retrieve the transaction information was'); @@ -359,41 +359,41 @@ while ($myrow=DB_fetch_array($Result)){ $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], - $myrow['typename'], - $myrow['transno'], - ConvertSQLDate($myrow['trandate']), - $myrow['suppreference'], - 0, - $myrow['total'], - $myrow['rate'], - $myrow['diffonexch'], - $myrow['diffonexch'], - $myrow['alloc'], - 'NA'); - } + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), + $myrow['suppreference'], + 0, + $myrow['total'], + $myrow['rate'], + $myrow['diffonexch'], + $myrow['diffonexch'], + $myrow['alloc'], + 'NA'); +} /* Now get trans that might have previously been allocated to by this trans NB existing entries where still some of the trans outstanding entered from above logic will be overwritten with the prev alloc detail below */ $SQL = "SELECT supptrans.id, - typename, - transno, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - diffonexch, - supptrans.alloc-suppallocs.amt AS prevallocs, - amt, - suppallocs.id AS allocid - FROM supptrans, - systypes, - suppallocs - WHERE supptrans.type = systypes.typeid - AND supptrans.id=suppallocs.transid_allocto - AND suppallocs.transid_allocfrom='" . $_SESSION['AllocTrans'] . - "' AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; + typename, + transno, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + diffonexch, + supptrans.alloc-suppallocs.amt AS prevallocs, + amt, + suppallocs.id AS allocid + FROM supptrans, + systypes, + suppallocs + WHERE supptrans.type = systypes.typeid + AND supptrans.id=suppallocs.transid_allocto + AND suppallocs.transid_allocfrom='" . $_SESSION['AllocTrans'] . + "' AND supplierno='" . $_SESSION['Alloc']->SupplierID . "'"; $ErrMsg = _('There was a problem retrieving the previously allocated transactions for modification'); @@ -405,14 +405,16 @@ $DiffOnExchThisOne = ($myrow['amt']/$myrow['rate']) - ($myrow['amt']/$_SESSION['Alloc']->TransExRate); - $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], $myrow['typename'], $myrow['transno'], - ConvertSQLDate($myrow['trandate']), $myrow['suppreference'], $myrow['amt'], - $myrow['total'], - $myrow['rate'], - $DiffOnExchThisOne, - ($myrow['diffonexch'] - $DiffOnExchThisOne), - $myrow['prevallocs'], - $myrow['allocid']); + $_SESSION['Alloc']->add_to_AllocsAllocn ($myrow['id'], + $myrow['typename'], + $myrow['transno'], + ConvertSQLDate($myrow['trandate']), $myrow['suppreference'], $myrow['amt'], + $myrow['total'], + $myrow['rate'], + $DiffOnExchThisOne, + ($myrow['diffonexch'] - $DiffOnExchThisOne), + $myrow['prevallocs'], + $myrow['allocid']); } } @@ -444,12 +446,12 @@ echo '<table cellpadding=2 colspan=7 class=selection>'; $TableHeader = '<tr><th>' . _('Type') . '</th> - <th>' . _('Trans') . '<br />' . _('Number') . '</th> - <th>' . _('Trans') .'<br />' . _('Date') . '</th> - <th>' . _('Supp') . '<br />' . _('Ref') . '</th> - <th>' . _('Total') . '<br />' . _('Amount') .'</th> - <th>' . _('Yet to') . '<br />' . _('Allocate') . '</th> - <th>' . _('This') . '<br />' . _('Allocation') . '</th></tr>'; + <th>' . _('Trans') . '<br />' . _('Number') . '</th> + <th>' . _('Trans') .'<br />' . _('Date') . '</th> + <th>' . _('Supp') . '<br />' . _('Ref') . '</th> + <th>' . _('Total') . '<br />' . _('Amount') .'</th> + <th>' . _('Yet to') . '<br />' . _('Allocate') . '</th> + <th>' . _('This') . '<br />' . _('Allocation') . '</th></tr>'; $k = 0; $Counter = 0; $RowCounter = 0; @@ -481,11 +483,11 @@ $YetToAlloc = ($AllocnItem->TransAmount - $AllocnItem->PrevAlloc); echo '<td>' . $AllocnItem->TransType . '</td> - <td>' . $AllocnItem->TypeNo . '</td> - <td>' . $AllocnItem->TransDate . '</td> - <td>' . $AllocnItem->SuppRef . '</td> - <td class="number">' . number_format($AllocnItem->TransAmount,2) . '</td> - <td class="number">' . number_format($YetToAlloc,2) . '<input type="hidden" name="YetToAlloc' . + <td>' . $AllocnItem->TypeNo . '</td> + <td>' . $AllocnItem->TransDate . '</td> + <td>' . $AllocnItem->SuppRef . '</td> + <td class="number">' . number_format($AllocnItem->TransAmount,2) . '</td> + <td class="number">' . number_format($YetToAlloc,2) . '<input type="hidden" name="YetToAlloc' . $Counter . '" VALUE=' . $YetToAlloc . '></td>'; echo '<td class="number"><input type="checkbox" name="All' . $Counter . '"'; @@ -551,12 +553,12 @@ echo '<table class=selection>'; $TableHeader = '<tr><th>' . _('Trans Type') .'</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('To Alloc') . '</th> - </tr>\n'; + <th>' . _('Supplier') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('To Alloc') . '</th> + </tr>\n'; echo $TableHeader; @@ -587,7 +589,7 @@ ConvertSQLDate($myrow['trandate']), $myrow['total'], $myrow['total']-$myrow['alloc'], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow['id']); } @@ -600,35 +602,35 @@ unset($_SESSION['Alloc']); $sql = "SELECT id, - transno, - typename, - type, - suppliers.supplierid, - suppname, - trandate, - suppreference, - rate, - ovamount+ovgst AS total, - alloc - FROM supptrans, - suppliers, - systypes - WHERE supptrans.type=systypes.typeid - AND supptrans.supplierno=suppliers.supplierid - AND (type=21 or type=22) - AND settled=0 ORDER BY id"; + transno, + typename, + type, + suppliers.supplierid, + suppname, + trandate, + suppreference, + rate, + ovamount+ovgst AS total, + alloc + FROM supptrans, + suppliers, + systypes + WHERE supptrans.type=systypes.typeid + AND supptrans.supplierno=suppliers.supplierid + AND (type=21 or type=22) + AND settled=0 ORDER BY id"; $result = DB_query($sql, $db); echo '<table class=selection>'; $TableHeader = '<tr><th>' . _('Trans Type') . '</th> - <th>' . _('Supplier') . '</th> - <th>' . _('Number') . '</th> - <th>' . _('Date') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('To Alloc') . '</th> - <th>' . _('More Info') . '</th> - </tr>' ; + <th>' . _('Supplier') . '</th> + <th>' . _('Number') . '</th> + <th>' . _('Date') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('To Alloc') . '</th> + <th>' . _('More Info') . '</th> + </tr>' ; echo $TableHeader; Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/UpgradeDatabase.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -98,6 +98,7 @@ case '3.10': $SQLScripts[] = './sql/mysql/upgrade3.10-3.11.sql'; case '3.11': + case '3.12.32': case '4.0RC1': case '4.01': case '4.02': @@ -195,4 +196,4 @@ } /*Dont do upgrade */ include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/Z_ImportStocks.php =================================================================== --- trunk/Z_ImportStocks.php 2011-05-07 00:24:37 UTC (rev 4562) +++ trunk/Z_ImportStocks.php 2011-05-11 09:59:44 UTC (rev 4563) @@ -1,308 +1,308 @@ -<?php -/* $Id: Z_ImportStocks.php 4043 2010-09-30 16:17:53Z tim_schofield $*/ -/* Script to make stock locations for all parts that do not have stock location records set up*/ - -//$PageSecurity = 15; -include('includes/session.inc'); -$title = _('Import Items'); -include('includes/header.inc'); - -// If this script is called with a file object, then the file contents are imported -// If this script is called with the gettemplate flag, then a template file is served -// Otherwise, a file upload form is displayed - -$headers = array( - 'StockID', // 0 'STOCKID', - 'Description', // 1 'DESCRIPTION', - 'LongDescription', // 2 'LONGDESCRIPTION', - 'CategoryID', // 3 'CATEGORYID', - 'Units', // 4 'UNITS', - 'MBFlag', // 5 'MBFLAG', - 'EOQ', // 6 'EOQ', - 'Discontinued', // 7 'DISCONTINUED', - 'Controlled', // 8 'CONTROLLED', - 'Serialised', // 9 'SERIALISED', - 'Perishable', // 10 'PERISHABLE', - 'Volume', // 11 'VOLUME', - 'KGS', // 12 'KGS', - 'BarCode', // 13 'BARCODE', - 'DiscountCategory', // 14 'DISCOUNTCATEGORY', - 'TaxCat', // 15 'TAXCAT', - 'DecimalPlaces', // 16 'DECIMALPLACES', - 'ItemPDF' // 17 'ITEMPDF' -); - -if ($_FILES['userfile']['name']) { //start file processing - - //initialize - $allowType='text/csv'; - $fieldTarget = 18; - $InputError = 0; - - //check file info - $fileName = $_FILES['userfile']['name']; - $tmpName = $_FILES['userfile']['tmp_name']; - $fileSize = $_FILES['userfile']['size']; - $fileType = $_FILES['userfile']['type']; - if ($fileType != $allowType) { - prnMsg (_('File has type '. $fileType. ', but only '. $allowType. ' is allowed.'),'error'); - include('includes/footer.inc'); - exit; - } - - //get file handle - $handle = fopen($tmpName, 'r'); - - //get the header row - $headRow = fgetcsv($handle, 10000, ","); - - //check for correct number of fields - if ( count($headRow) != count($headers) ) { - prnMsg (_('File contains '. count($headRow). ' columns, expected '. count($headers). '. Try downloading a new template.'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - - //test header row field name and sequence - $head = 0; - foreach ($headRow as $headField) { - if ( strtoupper($headField) != strtoupper($headers[$head]) ) { - prnMsg (_('File contains incorrect headers ('. strtoupper($headField). ' != '. strtoupper($header[$head]). '. Try downloading a new template.'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - $head++; - } - - //start database transaction - DB_Txn_Begin($db); - - //loop through file rows - $row = 1; - while ( ($myrow = fgetcsv($handle, 10000, ",")) !== FALSE ) { - - //check for correct number of fields - $fieldCount = count($myrow); - if ($fieldCount != $fieldTarget){ - prnMsg (_($fieldTarget. ' fields required, '. $fieldCount. ' fields received'),'error'); - fclose($handle); - include('includes/footer.inc'); - exit; - } - - // cleanup the data (csv files often import with empty strings and such) - $StockID = strtoupper($myrow[0]); - foreach ($myrow as &$value) { - $value = trim($value); - } - - //first off check if the item already exists - $sql = "SELECT COUNT(stockid) FROM stockmaster WHERE stockid='".$StockID."'"; - $result = DB_query($sql,$db); - $testrow = DB_fetch_row($result); - if ($testrow[0] != 0) { - $InputError = 1; - prnMsg (_('Stock item "'. $StockID. '" already exists'),'error'); - } - - //next validate inputs are sensible - if (!$myrow[1] or strlen($myrow[1]) > 50 OR strlen($myrow[1])==0) { - $InputError = 1; - prnMsg (_('The stock item description must be entered and be fifty characters or less long') . '. ' . _('It cannot be a zero length string either') . ' - ' . _('a description is required'). ' ("'. implode('","',$myrow). $stockid. '") ','error'); - } - if (strlen($myrow[2])==0) { - $InputError = 1; - prnMsg (_('The stock item description cannot be a zero length string') . ' - ' . _('a long description is required'),'error'); - } - if (strlen($StockID) ==0) { - $InputError = 1; - prnMsg (_('The Stock Item code cannot be empty'),'error'); - } - if (strstr($StockID,' ') OR strstr($StockID,"'") OR strstr($StockID,'+') OR strstr($StockID,"\\") OR strstr($StockID,"\"") OR strstr($StockID,'&') OR strstr($StockID,'"')) { - $InputError = 1; - prnMsg(_('The stock item code cannot contain any of the following characters') . " ' & + \" \\ " . _('or a space'). " (". $StockID. ")",'error'); - $StockID=''; - } - if (strlen($myrow[4]) >20) { - $InputError = 1; - prnMsg(_('The unit of measure must be 20 characters or less long'),'error'); - } - if (strlen($myrow[13]) >20) { - $InputError = 1; - prnMsg(_('The barcode must be 20 characters or less long'),'error'); - } - if ($myrow[10]!=0 AND $myrow[10]!=1) { - $InputError = 1; - prnMsg (_('Values in the Perishable field must be either 0 (No) or 1 (Yes)') ,'error'); - } - if (!is_numeric($myrow[11])) { - $InputError = 1; - prnMsg (_('The volume of the packaged item in cubic metres must be numeric') ,'error'); - } - if ($myrow[11] <0) { - $InputError = 1; - prnMsg(_('The volume of the packaged item must be a positive number'),'error'); - } - if (!is_numeric($myrow[12])) { - $InputError = 1; - prnMsg(_('The weight of the packaged item in KGs must be numeric'),'error'); - } - if ($myrow[12]<0) { - $InputError = 1; - prnMsg(_('The weight of the packaged item must be a positive number'),'error'); - } - if (!is_numeric($myrow[6])) { - $InputError = 1; - prnMsg(_('The economic order quantity must be numeric'),'error'); - } - if ($$myrow[6] <0) { - $InputError = 1; - prnMsg (_('The economic order quantity must be a positive number'),'error'); - } - if ($myrow[8]==0 AND $myrow[9]==1){ - $InputError = 1; - prnMsg(_('The item can only be serialised if there is lot control enabled already') . '. ' . _('Batch control') . ' - ' . _('with any number of items in a lot/bundle/roll is enabled when controlled is enabled') . '. ' . _('Serialised control requires that only one item is in the batch') . '. ' . _('For serialised control') . ', ' . _('both controlled and serialised must be enabled'),'error'); - } - - $mbflag = $myrow[5]; - if ($mbflag!='M' and $mbflag!='K' and $mbflag!='A' and $mbflag!='B' and $mbflag!='D' and $mbflag!='G') { - $InputError = 1; - prnMsg(_('Items must be of MBFlag type Manufactured(M), Assembly(A), Kit-Set(K), Purchased(B), Dummy(D) or Phantom(G)'),'error'); - } - if (($mbflag=='A' OR $mbflag=='K' OR $mbflag=='D' OR $mbflag=='G') AND $myrow[8]==1){ - $InputError = 1; - prnMsg(_('Assembly/Kitset/Phantom/Service items cannot also be controlled items') . '. ' . _('Assemblies, Dummies and Kitsets are not physical items and batch/serial control is therefore not appropriate'),'error'); - } - if ($myrow[3]==''){ - $InputError = 1; - prnMsg(_('There are no inventory categories defined. All inventory items must belong to a valid inventory category,'),'error'); - } - if ($myrow[17]==''){ - $InputError = 1; - prnMsg(_('ItemPDF must contain either a filename, or the keyword `none`'),'error'); - } - - if ($InputError !=1){ - if ($myrow[9]==1){ /*Not appropriate to have several dp on serial items */ - $myrow[16]=0; - } - - //attempt ... [truncated message content] |
From: <dai...@us...> - 2011-05-07 00:24:46
|
Revision: 4562 http://web-erp.svn.sourceforge.net/web-erp/?rev=4562&view=rev Author: daintree Date: 2011-05-07 00:24:37 +0000 (Sat, 07 May 2011) Log Message: ----------- various Modified Paths: -------------- trunk/PrintCustTrans.php trunk/PrintCustTransPortrait.php trunk/Shipt_Select.php trunk/Stocks.php trunk/UpgradeDatabase.php trunk/doc/Change.log trunk/includes/PDFTransPageHeader.inc trunk/includes/session.inc Modified: trunk/PrintCustTrans.php =================================================================== --- trunk/PrintCustTrans.php 2011-05-03 10:05:05 UTC (rev 4561) +++ trunk/PrintCustTrans.php 2011-05-07 00:24:37 UTC (rev 4562) @@ -1,7 +1,9 @@ <?php + /* $Id$ */ -include ('includes/session.inc'); +include('includes/session.inc'); + if (isset($_GET['FromTransNo'])) { $FromTransNo = trim($_GET['FromTransNo']); } elseif (isset($_POST['FromTransNo'])) { @@ -9,43 +11,74 @@ } else { $FromTransNo = ''; } + if (isset($_GET['InvOrCredit'])) { $InvOrCredit = $_GET['InvOrCredit']; } elseif (isset($_POST['InvOrCredit'])) { $InvOrCredit = $_POST['InvOrCredit']; } + if (isset($_GET['PrintPDF'])) { $PrintPDF = TRUE; } elseif (isset($_POST['PrintPDF'])) { $PrintPDF = TRUE; } -if (!isset($_POST['ToTransNo']) or trim($_POST['ToTransNo']) == '' or $_POST['ToTransNo'] < $FromTransNo) { + +if (!isset($_POST['ToTransNo']) + or trim($_POST['ToTransNo'])=='' + or $_POST['ToTransNo'] < $FromTransNo) { + $_POST['ToTransNo'] = $FromTransNo; } + $FirstTrans = $FromTransNo; /* Need to start a new page only on subsequent transactions */ -if ($FromTransNo=='Preview') { - $FormDesign = simplexml_load_file(sys_get_temp_dir().'/SalesInvoice.xml'); -} else { - $FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/SalesInvoice.xml'); -} -if (isset($PrintPDF) or isset($_GET['PrintPDF']) and $PrintPDF and isset($FromTransNo) and isset($InvOrCredit) and $FromTransNo != '') { - $PaperSize = $FormDesign->PaperSize; - include ('includes/PDFStarter.php'); - if ($InvOrCredit == 'Invoice') { - $pdf->addInfo('Title', _('Sales Invoice') . ' ' . $FromTransNo . ' to ' . $_POST['ToTransNo']); - $pdf->addInfo('Subject', _('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); + +if (isset($PrintPDF) OR isset($_GET['PrintPDF']) + AND $PrintPDF + AND isset($FromTransNo) + AND isset($InvOrCredit) + AND $FromTransNo!=''){ + + include ('includes/class.pdf.php'); + + /* This invoice is hard coded for A4 Landscape invoices or credit notes so can't use PDFStarter.inc */ + + $Page_Width=842; + $Page_Height=595; + $Top_Margin=30; + $Bottom_Margin=30; + $Left_Margin=40; + $Right_Margin=30; + + + $pdf = new Cpdf('L', 'pt', 'A4'); + $pdf->addInfo('Creator', 'webERP http://www.weberp.org'); + $pdf->addInfo('Author', 'webERP ' . $Version); + + if ($InvOrCredit=='Invoice') { + $pdf->addInfo('Title',_('Sales Invoice') . ' ' . $FromTransNo . ' to ' . $_POST['ToTransNo']); + $pdf->addInfo('Subject',_('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); } else { - $pdf->addInfo('Title', _('Sales Credit Note')); - $pdf->addInfo('Subject', _('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); + $pdf->addInfo('Title',_('Sales Credit Note') ); + $pdf->addInfo('Subject',_('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']); } + $pdf->setAutoPageBreak(0); + $pdf->setPrintHeader(false); + $pdf->AddPage(); + $pdf->cMargin = 0; +/* END Brought from class.pdf.php constructor */ + $FirstPage = true; - $line_height = $FormDesign->LineHeight; - while ($FromTransNo <= $_POST['ToTransNo']) { - /* retrieve the invoice details from the database to print - notice that salesorder record must be present to print the invoice purging of sales orders will - nobble the invoice reprints */ - if ($InvOrCredit == 'Invoice') { + $line_height=16; + + while ($FromTransNo <= $_POST['ToTransNo']){ + + /* retrieve the invoice details from the database to print + notice that salesorder record must be present to print the invoice purging of sales orders will + nobble the invoice reprints */ + + if ($InvOrCredit=='Invoice') { $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, @@ -111,7 +144,8 @@ AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode AND salesorders.fromstkloc=locations.loccode"; - if (isset($_POST['PrintEDI']) and $_POST['PrintEDI'] == 'No') { + + if (isset($_POST['PrintEDI']) and $_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } else { @@ -161,31 +195,29 @@ AND debtortrans.debtorno=custbranch.debtorno AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode"; - if ($_POST['PrintEDI'] == 'No') { + + if ($_POST['PrintEDI']=='No') { $sql = $sql . " AND debtorsmaster.ediinvoices=0"; } } // end else - if ($FromTransNo!='Preview') { - $result = DB_query($sql, $db, '', '', false, false); - if (DB_error_no($db) != 0) { - $title = _('Transaction Print Error Report'); - include ('includes/header.inc'); - prnMsg(_('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'), 'error'); - if ($debug == 1) { - prnMsg(_('The SQL used to get this information that failed was') . '<br />' . $sql, 'error'); - } - include ('includes/footer.inc'); - exit; + + $result=DB_query($sql, $db, '', '',false, false); + + if (DB_error_no($db)!=0) { + $title = _('Transaction Print Error Report'); + include ('includes/header.inc'); + prnMsg( _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'),'error'); + if ($debug==1) { + prnMsg (_('The SQL used to get this information that failed was') . '<br />' . $sql,'error'); } + include ('includes/footer.inc'); + exit; } - if ($FromTransNo=='Preview' or DB_num_rows($result) == 1) { - if ($FromTransNo!='Preview') { - $myrow = DB_fetch_array($result); - $ExchRate = $myrow['rate']; - } else { - $ExchRate = 'X'; - } - if ($InvOrCredit == 'Invoice') { + if (DB_num_rows($result)==1) { + $myrow = DB_fetch_array($result); + $ExchRate = $myrow['rate']; + if ($InvOrCredit=='Invoice') { + $sql = "SELECT stockmoves.stockid, stockmaster.description, -stockmoves.qty as quantity, @@ -193,16 +225,15 @@ ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . "* -stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, - stockmaster.units, - stockmaster.decimalplaces + stockmaster.units FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=10 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno=" . $FromTransNo . " AND stockmoves.show_on_inv_crds=1"; } else { - /* only credit notes to be retrieved */ + /* only credit notes to be retrieved */ $sql = "SELECT stockmoves.stockid, stockmaster.description, stockmoves.qty as quantity, @@ -210,224 +241,294 @@ ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, (stockmoves.price * " . $ExchRate . ") AS fxprice, stockmoves.narrative, - stockmaster.units, - stockmaster.decimalplaces + stockmaster.units FROM stockmoves, stockmaster WHERE stockmoves.stockid = stockmaster.stockid AND stockmoves.type=11 - AND stockmoves.transno='" . $FromTransNo . "' + AND stockmoves.transno=" . $FromTransNo . " AND stockmoves.show_on_inv_crds=1"; } // end else - if ($FromTransNo!='Preview') { - $result = DB_query($sql, $db); - } - if (DB_error_no($db) != 0) { + + $result=DB_query($sql,$db); + if (DB_error_no($db)!=0) { $title = _('Transaction Print Error Report'); include ('includes/header.inc'); echo '<br />' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database'); - if ($debug == 1) { - echo '<br />' . _('The SQL used to get this information that failed was') . '<br />' . $sql; + if ($debug==1) { + echo '<br />' . _('The SQL used to get this information that failed was') . '<br>' . $sql; } - include ('includes/footer.inc'); + include('includes/footer.inc'); exit; } - if ($FromTransNo=='Preview' or DB_num_rows($result) > 0) { + + if (DB_num_rows($result)>0) { + + $FontSize = 10; $PageNumber = 1; - include ('includes/PDFTransPageHeader.inc'); + + include('includes/PDFTransPageHeader.inc'); $FirstPage = False; - $YPos = $Page_Height - $FormDesign->Data->y; - $Line=1; - while (($FromTransNo=='Preview' and $Line==1) or (isset($result) and $myrow2 = DB_fetch_array($result))) { - if ($myrow2['discountpercent'] == 0) { - $DisplayDiscount = ''; + while ($myrow2=DB_fetch_array($result)) { + + if ($myrow2['discountpercent']==0) { + $DisplayDiscount =''; } else { - $DisplayDiscount = number_format($myrow2['discountpercent'] * 100, 2) . '%'; - $DiscountPrice = $myrow2['fxprice'] * (1 - $myrow2['discountpercent']); + $DisplayDiscount = number_format($myrow2['discountpercent']*100,2) . '%'; + $DiscountPrice=$myrow2['fxprice']*(1-$myrow2['discountpercent']); } - $DisplayNet = number_format($myrow2['fxnet'], 2); - $DisplayPrice = $myrow2['fxprice']; - $DisplayQty = $myrow2['quantity']; - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x, $YPos,$FormDesign->Data->Column1->Length, $FormDesign->Data->Column1->FontSize, $myrow2['stockid']); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x, $YPos,$FormDesign->Data->Column2->Length, $FormDesign->Data->Column2->FontSize, $myrow2['description']); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x, $YPos,$FormDesign->Data->Column3->Length, $FormDesign->Data->Column3->FontSize, number_format($DisplayPrice,4), 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x, $YPos,$FormDesign->Data->Column4->Length, $FormDesign->Data->Column4->FontSize, number_format($DisplayQty,$myrow2['decimalplaces']), 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x, $YPos,$FormDesign->Data->Column5->Length, $FormDesign->Data->Column5->FontSize, $myrow2['units'], 'centre'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column6->x, $YPos,$FormDesign->Data->Column6->Length, $FormDesign->Data->Column6->FontSize, $DisplayDiscount, 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column7->x, $YPos,$FormDesign->Data->Column7->Length, $FormDesign->Data->Column7->FontSize, $DisplayNet, 'right'); - $YPos-= ($line_height); - $lines = explode('\r\n', htmlspecialchars_decode($myrow2['narrative'])); - for ($i = 0;$i < sizeOf($lines);$i++) { - while (strlen($lines[$i]) > 1) { - if ($YPos - $line_height <= $Bottom_Margin) { + $DisplayNet=number_format($myrow2['fxnet'],2); + $DisplayPrice=number_format($myrow2['fxprice'],3); + $DisplayQty=$myrow2['quantity']; + + $LeftOvers = $pdf->addTextWrap($Left_Margin+3,$YPos,95,$FontSize,$myrow2['stockid']); + $LeftOvers = $pdf->addTextWrap($Left_Margin+100,$YPos,123,$FontSize,$myrow2['description']); + $LeftOvers = $pdf->addTextWrap($Left_Margin+353,$YPos,96,$FontSize,$DisplayPrice,'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+453,$YPos,95,$FontSize,$DisplayQty,'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+553,$YPos,35,$FontSize,$myrow2['units'],'centre'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+590,$YPos,50,$FontSize,$DisplayDiscount,'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos,120,$FontSize,$DisplayNet,'right'); + + $YPos -= ($line_height); + + $lines=explode('\r\n',htmlspecialchars_decode($myrow2['narrative'])); + for ($i=0;$i<sizeOf($lines);$i++) { + while (strlen($lines[$i])>1) { + if ($YPos-$line_height <= $Bottom_Margin) { /* head up a new invoice/credit note page */ /* draw the vertical column lines right to the bottom */ - PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign); - include ('includes/PDFTransPageHeaderPortrait.inc'); - } //end if need a new page headed up - /* increment a line down for the next line item */ - if (strlen($lines[$i]) > 1) { - $lines[$i] = $pdf->addTextWrap($Left_Margin + 100, $YPos, 245, $FontSize, stripslashes($lines[$i])); + PrintLinesToBottom (); + include ('includes/PDFTransPageHeaderPortrait.inc'); + } //end if need a new page headed up + + /* increment a line down for the next line item */ + if (strlen($lines[$i])>1){ + $lines[$i] = $pdf->addTextWrap($Left_Margin+100,$YPos,245,$FontSize,stripslashes($lines[$i])); } - $YPos-= ($line_height); - } - } + $YPos -= ($line_height); + } + } //end for loop around lines of narrative to display if ($YPos <= $Bottom_Margin) { + /* head up a new invoice/credit note page */ /*draw the vertical column lines right to the bottom */ - PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign); + PrintLinesToBottom (); include ('includes/PDFTransPageHeader.inc'); } //end if need a new page headed up - $Line++; - } //end while there are line items to print out + } //end while there invoice are line items to print out + } /*end if there are stock movements to show on the invoice or credit note*/ - } /*end if there are stock movements to show on the invoice or credit note*/ - $YPos-= $line_height; + $YPos -= $line_height; + /* check to see enough space left to print the 4 lines for the totals/footer */ - if (($YPos - $Bottom_Margin) < (2 * $line_height)) { - PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign); + if (($YPos-$Bottom_Margin)<(2*$line_height)) { + PrintLinesToBottom (); include ('includes/PDFTransPageHeader.inc'); } /* Print a column vertical line with enough space for the footer */ /* draw the vertical column lines to 4 lines shy of the bottom to leave space for invoice footer info ie totals etc */ - $pdf->line($FormDesign->DataLines->Line1->startx, $Page_Height - $FormDesign->DataLines->Line1->starty, $FormDesign->DataLines->Line1->endx, $Page_Height - $FormDesign->DataLines->Line1->endy); + $pdf->line($Left_Margin+97, $TopOfColHeadings+12,$Left_Margin+97,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line2->startx, $Page_Height - $FormDesign->DataLines->Line2->starty, $FormDesign->DataLines->Line2->endx, $Page_Height - $FormDesign->DataLines->Line2->endy); + $pdf->line($Left_Margin+350, $TopOfColHeadings+12,$Left_Margin+350,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line3->startx, $Page_Height - $FormDesign->DataLines->Line3->starty, $FormDesign->DataLines->Line3->endx, $Page_Height - $FormDesign->DataLines->Line3->endy); + $pdf->line($Left_Margin+450, $TopOfColHeadings+12,$Left_Margin+450,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line4->startx, $Page_Height - $FormDesign->DataLines->Line4->starty, $FormDesign->DataLines->Line4->endx, $Page_Height - $FormDesign->DataLines->Line4->endy); + $pdf->line($Left_Margin+550, $TopOfColHeadings+12,$Left_Margin+550,$Bottom_Margin+(4*$line_height)); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line5->startx, $Page_Height - $FormDesign->DataLines->Line5->starty, $FormDesign->DataLines->Line5->endx, $Page_Height - $FormDesign->DataLines->Line5->endy); - $pdf->line($FormDesign->DataLines->Line6->startx, $Page_Height - $FormDesign->DataLines->Line6->starty, $FormDesign->DataLines->Line6->endx, $Page_Height - $FormDesign->DataLines->Line6->endy); + $pdf->line($Left_Margin+587, $TopOfColHeadings+12,$Left_Margin+587,$Bottom_Margin+(4*$line_height)); + + $pdf->line($Left_Margin+640, $TopOfColHeadings+12,$Left_Margin+640,$Bottom_Margin+(4*$line_height)); + /* Rule off at bottom of the vertical lines */ - $pdf->line($FormDesign->LineAboveFooter->startx, $Page_Height - $FormDesign->LineAboveFooter->starty, $FormDesign->LineAboveFooter->endx, $Page_Height - $FormDesign->LineAboveFooter->endy); + $pdf->line($Left_Margin, $Bottom_Margin+(4*$line_height),$Page_Width-$Right_Margin,$Bottom_Margin+(4*$line_height)); + /* Now print out the footer and totals */ - if ($InvOrCredit == 'Invoice') { - $DisplaySubTot = number_format($myrow['ovamount'], 2); - $DisplayFreight = number_format($myrow['ovfreight'], 2); - $DisplayTax = number_format($myrow['ovgst'], 2); - $DisplayTotal = number_format($myrow['ovfreight'] + $myrow['ovgst'] + $myrow['ovamount'], 2); + + if ($InvOrCredit=='Invoice') { + + $DisplaySubTot = number_format($myrow['ovamount'],2); + $DisplayFreight = number_format($myrow['ovfreight'],2); + $DisplayTax = number_format($myrow['ovgst'],2); + $DisplayTotal = number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],2); + } else { - $DisplaySubTot = number_format(-$myrow['ovamount'], 2); - $DisplayFreight = number_format(-$myrow['ovfreight'], 2); - $DisplayTax = number_format(-$myrow['ovgst'], 2); - $DisplayTotal = number_format(-$myrow['ovfreight'] - $myrow['ovgst'] - $myrow['ovamount'], 2); + + $DisplaySubTot = number_format(-$myrow['ovamount'],2); + $DisplayFreight = number_format(-$myrow['ovfreight'],2); + $DisplayTax = number_format(-$myrow['ovgst'],2); + $DisplayTotal = number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],2); } + /* Print out the invoice text entered */ + $YPos = $Bottom_Margin+(3*$line_height); + /* Print out the payment terms */ - $pdf->addTextWrap($FormDesign->PaymentTerms->x, $Page_Height - $FormDesign->PaymentTerms->y, $FormDesign->PaymentTerms->Length, $FormDesign->PaymentTerms->FontSize, _('Payment Terms') . ': ' . $myrow['terms']); - // $pdf->addText($Page_Width-$Right_Margin-392, $YPos - ($line_height*3)+22,$FontSize, _('Bank Code:***** Bank Account:*****')); - // $FontSize=10; - $LeftOvers=explode('\r\n',DB_escape_string($myrow['invtext'])); - for ($i=0;$i<sizeOf($LeftOvers);$i++) { - $pdf->addText($FormDesign->InvoiceText->x, $Page_Height - $FormDesign->InvoiceText->y-($i*10), $FormDesign->InvoiceText->FontSize, $LeftOvers[$i]); + $pdf->addTextWrap($Left_Margin+5,$YPos+3,280,$FontSize,_('Payment Terms') . ': ' . $myrow['terms']); + // $pdf->addText($Page_Width-$Right_Margin-392, $YPos - ($line_height*3)+22,$FontSize, _('Bank Code:***** Bank Account:*****')); + // $FontSize=10; + + $FontSize =8; + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-12,280,$FontSize,$myrow['invtext']); + if (strlen($LeftOvers)>0) { + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-24,280,$FontSize,$LeftOvers); + if (strlen($LeftOvers)>0) { + $LeftOvers = $pdf->addTextWrap($Left_Margin+5,$YPos-36,280,$FontSize,$LeftOvers); + /*If there is some of the InvText leftover after 3 lines 200 wide then it is not printed :( */ + } } - $pdf->addText($FormDesign->SubTotalCaption->x, $Page_Height - $FormDesign->SubTotalCaption->y, $FormDesign->SubTotalCaption->FontSize, _('Sub Total')); - $LeftOvers = $pdf->addTextWrap($FormDesign->SubTotal->x, $Page_Height - $FormDesign->SubTotal->y, $FormDesign->SubTotal->Length, $FormDesign->SubTotal->FontSize, $DisplaySubTot, 'right'); - $pdf->addText($FormDesign->FreightCaption->x, $Page_Height - $FormDesign->FreightCaption->y, $FormDesign->FreightCaption->FontSize, _('Freight')); - $LeftOvers = $pdf->addTextWrap($FormDesign->Freight->x, $Page_Height - $FormDesign->Freight->y, $FormDesign->Freight->Length, $FormDesign->Freight->FontSize, $DisplayFreight, 'right'); - $pdf->addText($FormDesign->TaxCaption->x, $Page_Height - $FormDesign->TaxCaption->y, $FormDesign->TaxCaption->FontSize, _('Tax')); - $LeftOvers = $pdf->addTextWrap($FormDesign->Tax->x, $Page_Height - $FormDesign->Tax->y, $FormDesign->Tax->Length, $FormDesign->Tax->FontSize, $DisplayTax, 'right'); + $FontSize = 10; + + $pdf->addText($Page_Width-$Right_Margin-220, $YPos+15,$FontSize, _('Sub Total')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos+5,120,$FontSize,$DisplaySubTot, 'right'); + + $pdf->addText($Page_Width-$Right_Margin-220, $YPos+2,$FontSize, _('Freight')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos-6,120,$FontSize,$DisplayFreight, 'right'); + + $pdf->addText($Page_Width-$Right_Margin-220, $YPos-10,$FontSize, _('Tax')); + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,$YPos-($line_height)-5,120, $FontSize,$DisplayTax, 'right'); + /*rule off for total */ - $pdf->line($FormDesign->TotalLine->startx, $Page_Height - $FormDesign->TotalLine->starty, $FormDesign->TotalLine->endx, $Page_Height - $FormDesign->TotalLine->endy); + $pdf->line($Page_Width-$Right_Margin-222, $YPos-(2*$line_height),$Page_Width-$Right_Margin,$YPos-(2*$line_height)); + /*vertical to separate totals from comments and ROMALPA */ - $pdf->line($FormDesign->RomalpaLine->startx, $Page_Height - $FormDesign->RomalpaLine->starty, $FormDesign->RomalpaLine->endx, $Page_Height - $FormDesign->RomalpaLine->endy); - if ($InvOrCredit == 'Invoice') { - $pdf->addText($FormDesign->TotalCaption->x, $Page_Height - $FormDesign->TotalCaption->y, $FormDesign->TotalCaption->FontSize, _('TOTAL INVOICE')); - $YPos=$FormDesign->Romalpa->y; - $LeftOvers = $pdf->addTextWrap($FormDesign->Romalpa->x, $Page_Height - $YPos, $FormDesign->Romalpa->Length, $FormDesign->Romalpa->FontSize, $_SESSION['RomalpaClause']); - while (strlen($LeftOvers) > 0 AND ($Page_Height - $YPos) > $Bottom_Margin) { - $YPos+= $FormDesign->Romalpa->FontSize+1; - $LeftOvers = $pdf->addTextWrap($FormDesign->Romalpa->x, $Page_Height - $YPos, $FormDesign->Romalpa->Length, $FormDesign->Romalpa->FontSize, $LeftOvers); + $pdf->line($Page_Width-$Right_Margin-222, $YPos+$line_height,$Page_Width-$Right_Margin-222,$Bottom_Margin); + + $YPos+=10; + if ($InvOrCredit=='Invoice') { + $pdf->addText($Page_Width-$Right_Margin-220, $YPos - ($line_height*2)-10,$FontSize, _('TOTAL INVOICE')); + $FontSize=9; + $YPos-=4; + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$_SESSION['RomalpaClause']); + while (strlen($LeftOvers)>0 AND $YPos > $Bottom_Margin) { + $YPos-=12; + $LeftOvers = $pdf->addTextWrap($Left_Margin+280,$YPos,220,$FontSize,$LeftOvers); } /* Add Images for Visa / Mastercard / Paypal */ if (file_exists('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg')) { - $pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg', $FormDesign->CreditCardLogo->x,$Page_Height -$FormDesign->CreditCardLogo->y,$FormDesign->CreditCardLogo->width,$FormDesign->CreditCardLogo->height); + $pdf->addJpegFromFile('companies/' . $_SESSION['DatabaseName'] . '/payment.jpg',$Page_Width/2 -280,$YPos-20,0,40); } -// $pdf->addText($Page_Width - $Right_Margin - 472, $YPos - ($line_height * 3) + 32, $FontSize, ''); + $pdf->addText($Page_Width-$Right_Margin-472, $YPos - ($line_height*3)+32,$FontSize, ''); + $FontSize=10; } else { - $pdf->addText($FormDesign->TotalCaption->x, $Page_Height - $FormDesign->TotalCaption->y, $FormDesign->TotalCaption->FontSize, _('TOTAL CREDIT')); - } - $LeftOvers = $pdf->addTextWrap($FormDesign->Total->x, $Page_Height - $FormDesign->Total->y, $FormDesign->Total->Length, $FormDesign->Total->FontSize, $DisplayTotal, 'right'); + $pdf->addText($Page_Width-$Right_Margin-220, $YPos-($line_height*2)-10,$FontSize, _('TOTAL CREDIT')); + } + $LeftOvers = $pdf->addTextWrap($Left_Margin+642,35,120, $FontSize,$DisplayTotal, 'right'); } /* end of check to see that there was an invoice record to print */ + $FromTransNo++; + } /* end loop to print invoices */ + + // Have to get the TransNo again, GET[FromTransNo] is updated on each pass of loop + if (isset($_GET['FromTransNo'])) { + $FromTransNo = trim($_GET['FromTransNo']); + } elseif (isset($_POST['FromTransNo'])) { + $FromTransNo = trim($_POST['FromTransNo']); } -} /* end loop to print invoices */ + + + if (isset($_GET['Email'])){ //email the invoice to address supplied + include('includes/header.inc'); -if (($InvOrCredit == 'Invoice' or $InvOrCredit == 'Credit') and isset($PrintPDF)) { - - if (isset($_GET['Email'])) { //email the invoice to address supplied - include ('includes/header.inc'); include ('includes/htmlMimeMail.php'); + $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'; + $pdf->Output($FileName,'F'); $mail = new htmlMimeMail(); - $FileName = $_SESSION['reports_dir'] . '/' . $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'; - $pdf->Output($FileName, 'F'); + $Attachment = $mail->getFile($FileName); - $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo']); + $mail->setText(_('Please find attached') . ' ' . $InvOrCredit . ' ' . $_GET['FromTransNo'] ); $mail->SetSubject($InvOrCredit . ' ' . $_GET['FromTransNo']); $mail->addAttachment($Attachment, $FileName, 'application/pdf'); $mail->setFrom($_SESSION['CompanyRecord']['coyname'] . ' <' . $_SESSION['CompanyRecord']['email'] . '>'); $result = $mail->send(array($_GET['Email'])); + unlink($FileName); //delete the temporary file - $title = _('Emailing') . ' ' . $InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo; - include ('includes/header.inc'); - echo '<p>' . $InvOrCredit . ' ' . _('number') . ' ' . $_GET['FromTransNo'] . ' ' . _('has been emailed to') . ' ' . $_GET['Email']; - include ('includes/footer.inc'); + + $title = _('Emailing') . ' ' .$InvOrCredit . ' ' . _('Number') . ' ' . $FromTransNo; + include('includes/header.inc'); + echo '<p>' . $InvOrCredit . ' ' . _('number') . ' ' . $FromTransNo . ' ' . _('has been emailed to') . ' ' . $_GET['Email']; + include('includes/footer.inc'); exit; - } else { - $pdf->OutputD( $_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $_GET['FromTransNo'] . '.pdf'); + + } else { //its not an email just print the invoice to PDF + $pdf->OutputD($_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $FromTransNo . '.pdf'); + } $pdf->__destruct(); + } else { /*The option to print PDF was not hit */ - $title = _('Select Invoices/Credit Notes To Print'); - include ('includes/header.inc'); - if (!isset($FromTransNo) OR $FromTransNo == '') { + + $title=_('Select Invoices/Credit Notes To Print'); + include('includes/header.inc'); + + if (!isset($FromTransNo) OR $FromTransNo=='') { + /* if FromTransNo is not set then show a form to allow input of either a single invoice number or a range of invoices to be printed. Also get the last invoice number created to show the user where the current range is up to */ - echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="POST"> - <table class="selection">'; + echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</p>'; - echo '<tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>'; - if ($InvOrCredit == 'Invoice' OR !isset($InvOrCredit)) { + + echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="">' . ' ' . _('Print Invoices or Credit Notes (Landscape Mode)') . '</div>'; + echo '<table class="table1"> + <tr><td>' . _('Print Invoices or Credit Notes') . '</td><td><select name=InvOrCredit>'; + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)) { + echo '<option selected value="Invoice">' . _('Invoices') . '</option>'; - echo '<option value="Credit">' . _('Credit Notes'). '</option>'; + echo '<option value="Credit">' . _('Credit Notes') . '</option>'; } else { echo '<option selected value="Credit">' . _('Credit Notes') . '</option>'; echo '<option value="Invoice">' . _('Invoices') . '</option>'; } + echo '</select></td></tr>'; echo '<tr><td>' . _('Print EDI Transactions') . '</td><td><select name=PrintEDI>'; - if ($InvOrCredit == 'Invoice' OR !isset($InvOrCredit)) { + + if ($InvOrCredit=='Invoice' OR !isset($InvOrCredit)) { + echo '<option selected value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; echo '<option value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; + } else { + echo '<option value="No">' . _('Do not Print PDF EDI Transactions') . '</option>'; echo '<option selected value="Yes">' . _('Print PDF EDI Transactions Too') . '</option>'; } + echo '</select></td></tr>'; echo '<tr><td>' . _('Start invoice/credit note number to print') . '</td> - <td><input type="text" class="number" max=6 size=7 name=FromTransNo></td></tr>'; + <td><input Type=text class=number max=6 size=7 name=FromTransNo></td></tr>'; echo '<tr><td>' . _('End invoice/credit note number to print') . '</td> - <td><input Type="text" class="number" max=6 size=7 name="ToTransNo"></td> - </tr></table>'; - echo '<br /><div class="centre"><input type="submit" name="Print" value="' . _('Print') . '"><p />'; + <td><input Type=text class=number max=6 size=7 name="ToTransNo"></td></tr> + </table>'; + echo '<div class="centre"><input type="submit" name="Print" value="' . _('Print') . '"><p>'; echo '<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + $sql = "SELECT typeno FROM systypes WHERE typeid=10"; - $result = DB_query($sql, $db); + + $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - echo '<div class="page_help_text"><b>' . _('The last invoice created was number') . ' ' . $myrow[0] . '</b><br />' . _('If only a single invoice is required') . ', ' . _('enter the invoice number to print in the Start transaction number to print field and leave the End transaction number to print field blank') . '. ' . _('Only use the end invoice to print field if you wish to print a sequential range of invoices') . ''; + + echo '<div class="page_help_text"><b>' . _('The last invoice created was number') . ' ' . $myrow[0] . '</b><br>' . _('If only a single invoice is required') . ', ' . _('enter the invoice number to print in the Start transaction number to print field and leave the End transaction number to print field blank') . '. ' . _('Only use the end invoice to print field if you wish to print a sequential range of invoices') . ''; + $sql = "SELECT typeno FROM systypes WHERE typeid=11"; - $result = DB_query($sql, $db); + + $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); - echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br />' . - _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</div>'; + + echo '<br /><b>' . _('The last credit note created was number') . ' ' . $myrow[0] . '</b><br />' . _('A sequential range can be printed using the same method as for invoices above') . '. ' . _('A single credit note can be printed by only entering a start transaction number') . '</DIV'; + } else { + while ($FromTransNo <= $_POST['ToTransNo']) { + /*retrieve the invoice details from the database to print notice that salesorder record must be present to print the invoice purging of sales orders will nobble the invoice reprints */ - if ($InvOrCredit == 'Invoice') { + + if ($InvOrCredit=='Invoice') { + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, @@ -480,6 +581,7 @@ AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode"; } else { + $sql = "SELECT debtortrans.trandate, debtortrans.ovamount, debtortrans.ovdiscount, @@ -515,63 +617,99 @@ AND debtortrans.branchcode=custbranch.branchcode AND custbranch.salesman=salesman.salesmancode"; } - $result = DB_query($sql, $db); - if (DB_num_rows($result) == 0 OR DB_error_no($db) != 0) { - echo '<div class="page_help_text">' . _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $FromTransNo . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available').'</div>'; - if ($debug == 1) { - echo _('The SQL used to get this information that failed was') . "<br />$sql"; + + $result=DB_query($sql,$db); + if (DB_num_rows($result)==0 OR DB_error_no($db)!=0) { + echo '<p>' . _('There was a problem retrieving the invoice or credit note details for note number') . ' ' . $InvoiceToPrint . ' ' . _('from the database') . '. ' . _('To print an invoice, the sales order record, the customer transaction record and the branch record for the customer must not have been purged') . '. ' . _('To print a credit note only requires the customer, transaction, salesman and branch records be available'); + if ($debug==1) { + echo _('The SQL used to get this information that failed was') . '<br>' . $sql; } break; - include ('includes/footer.inc'); + include('includes/footer.inc'); exit; - } elseif (DB_num_rows($result) == 1) { + } elseif (DB_num_rows($result)==1) { + $myrow = DB_fetch_array($result); /* Then there's an invoice (or credit note) to print. So print out the invoice header and GST Number from the company record */ - if (count($_SESSION['AllowedPageSecurityTokens']) == 1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']) { + if (count($_SESSION['AllowedPageSecurityTokens'])==1 AND in_array(1, $_SESSION['AllowedPageSecurityTokens']) AND $myrow['debtorno'] != $_SESSION['CustomerID']){ echo '<p><font color=RED size=4>' . _('This transaction is addressed to another customer and cannot be displayed for privacy reasons') . '. ' . _('Please select only transactions relevant to your company'); exit; } + $ExchRate = $myrow['rate']; $PageNumber = 1; - echo '<table class="table1"><tr><td VALIGN=TOP WIDTH=10%><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#BBBBBB"><b>'; - if ($InvOrCredit == 'Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + + echo '<table class="table1"> + <tr><td VALIGN=TOP WIDTH=10%><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#BBBBBB"><b>'; + + if ($InvOrCredit=='Invoice') { + echo '<font size=4>' . _('TAX INVOICE') . ' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br><font size=1>' . _('Tax Authority Ref') . '. ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + /* Now print out the logo and company name and address */ - echo '<table class="table1"><tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; - echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; - echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; - echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; - echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; + echo '<table class="table1"> + <tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>'; + echo '</td><td WIDTH=50% class=number>'; + /* Now the customer charged to details in a sub table within a cell of the main table*/ - echo '<table class="table1"><tr><td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td></tr><tr><td bgcolor="#EEEEEE">'; - echo $myrow['name'] . '<br />' . $myrow['address1'] . '<br />' . $myrow['address2'] . '<br />' . $myrow['address3'] . '<br />' . $myrow['address4'] . '<br />' . $myrow['address5'] . '<br />' . $myrow['address6']; + + echo '<table class="table1"> + <tr><td align=left bgcolor="#BBBBBB"><b>' . _('Charge To') . ':</b></td> + </tr><tr><td bgcolor="#EEEEEE">'; + echo $myrow['name'] . + '<br>' . $myrow['address1'] . + '<br>' . $myrow['address2'] . + '<br>' . $myrow['address3'] . + '<br>' . $myrow['address4'] . + '<br>' . $myrow['address5'] . + '<br>' . $myrow['address6']; echo '</td></tr></table>'; /*end of the small table showing charge to account details */ echo _('Page') . ': ' . $PageNumber; echo '</td></tr></table>'; /*end of the main table showing the company name and charge to details */ - if ($InvOrCredit == 'Invoice') { - echo '<table class="table1"> + + if ($InvOrCredit=='Invoice') { + + echo '<table class="table1"> <tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Charge Branch') . ':</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Delivered To') . ':</b></td> </tr>'; - echo '<tr> - <td bgcolor="#EEEEEE">' . $myrow['brname'] . '<br />' . $myrow['braddress1'] . '<br />' . $myrow['braddress2'] . '<br />' . $myrow['braddress3'] . '<br />' . $myrow['braddress4'] . '<br />' . $myrow['braddress5'] . '<br />' . $myrow['braddress6'] . '</td>'; - echo '<td bgcolor="#EEEEEE">' . $myrow['deliverto'] . '<br />' . $myrow['deladd1'] . '<br />' . $myrow['deladd2'] . '<br />' . $myrow['deladd3'] . '<br />' . $myrow['deladd4'] . '<br />' . $myrow['deladd5'] . '<br />' . $myrow['deladd6'] . '</td>'; - echo '</tr> - </table><hr>'; - echo '<table class="table1"> + echo '<tr> + <td bgcolor="#EEEEEE">' .$myrow['brname'] . + '<br>' . $myrow['braddress1'] . + '<br>' . $myrow['braddress2'] . + '<br>' . $myrow['braddress3'] . + '<br>' . $myrow['braddress4'] . + '<br>' . $myrow['braddress5'] . + '<br>' . $myrow['braddress6'] . '</td>'; + + echo '<td bgcolor="#EEEEEE">' . $myrow['deliverto'] . + '<br>' . $myrow['deladd1'] . + '<br>' . $myrow['deladd2'] . + '<br>' . $myrow['deladd3'] . + '<br>' . $myrow['deladd4'] . + '<br>' . $myrow['deladd5'] . + '<br>' . $myrow['deladd6'] . '</td> + </tr> + </table><hr>'; + + echo '<table class="table1"> <tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Your Order Ref') . '</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Our Order No') . '</b></td> @@ -581,9 +719,9 @@ <td align=left bgcolor="#BBBBBB"><b>' . _('Shipper') . '</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Consignment Ref') . '</b></td> </tr>'; - echo '<tr> + echo '<tr> <td bgcolor="#EEEEEE">' . $myrow['customerref'] . '</td> - <td bgcolor="#EEEEEE">' . $myrow['orderno'] . '</td> + <td bgcolor="#EEEEEE">' .$myrow['orderno'] . '</td> <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['orddate']) . '</td> <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> @@ -591,7 +729,8 @@ <td bgcolor="#EEEEEE">' . $myrow['consignment'] . '</td> </tr> </table>'; - $sql = "SELECT stockmoves.stockid, + + $sql ="SELECT stockmoves.stockid, stockmaster.description, -stockmoves.qty as quantity, stockmoves.discountpercent, @@ -605,26 +744,35 @@ AND stockmoves.type=10 AND stockmoves.transno='" . $FromTransNo . "' AND stockmoves.show_on_inv_crds=1"; + } else { /* then its a credit note */ - echo '<table width=50%><tr> + + echo '<table width="50%"><tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Branch') . ':</b></td> </tr>'; - echo '<tr> - <td bgcolor="#EEEEEE">' . $myrow['brname'] . '<br />' . $myrow['braddress1'] . '<br />' . $myrow['braddress2'] . '<br />' . $myrow['braddress3'] . '<br />' . $myrow['braddress4'] . '<br />' . $myrow['braddress5'] . '<br />' . $myrow['braddress6'] . '</td> + echo '<tr> + <td bgcolor="#EEEEEE">' .$myrow['brname'] . + '<br>' . $myrow['braddress1'] . + '<br>' . $myrow['braddress2'] . + '<br>' . $myrow['braddress3'] . + '<br>' . $myrow['braddress4'] . + '<br>' . $myrow['braddress5'] . + '<br>' . $myrow['braddress6'] . '</td> </tr></table>'; - echo '<hr><table class="table1"><tr> + echo '<hr><table class="table1"><tr> <td align=left bgcolor="#BBBBBB"><b>' . _('Date') . '</b></td> <td align=left bgcolor="#BBBBBB"><b>' . _('Sales Person') . '</font></b></td> </tr>'; - echo '<tr> + echo '<tr> <td bgcolor="#EEEEEE">' . ConvertSQLDate($myrow['trandate']) . '</td> <td bgcolor="#EEEEEE">' . $myrow['salesmanname'] . '</td> </tr></table>'; - $sql = "SELECT stockmoves.stockid, + + $sql ="SELECT stockmoves.stockid, stockmaster.description, stockmoves.qty as quantity, - stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * stockmoves.qty) AS fxnet, - (stockmoves.price * " . $ExchRate . ") AS fxprice, + stockmoves.discountpercent, ((1 - stockmoves.discountpercent) * stockmoves.price * ' . $ExchRate . ' * stockmoves.qty) AS fxnet, + (stockmoves.price * ' . $ExchRate . ') AS fxprice, stockmaster.units FROM stockmoves, stockmaster @@ -633,81 +781,109 @@ AND stockmoves.transno='" . $FromTransNo . "' AND stockmoves.show_on_inv_crds=1"; } + echo '<hr>'; echo '<div class="centre"><font size=2>' . _('All amounts stated in') . ' ' . $myrow['currcode'] . '</font></div>'; - $result = DB_query($sql, $db); - if (DB_error_no($db) != 0) { - echo '<div class="page_help_text">' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database').'</div>'; - if ($debug == 1) { - echo '<br />' . _('The SQL used to get this information that failed was') . '<br />'.$sql; + + $result=DB_query($sql,$db); + if (DB_error_no($db)!=0) { + echo '<br>' . _('There was a problem retrieving the invoice or credit note stock movement details for invoice number') . ' ' . $FromTransNo . ' ' . _('from the database'); + if ($debug==1){ + echo '<br>' . _('The SQL used to get this information that failed was') . '<br>' .$sql; } exit; } - if (DB_num_rows($result) > 0) { + + if (DB_num_rows($result)>0){ echo '<table class="table1"> <tr><th>' . _('Item Code') . '</th> - <th>' . _('Item Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('Net') . '</th></tr>'; - $LineCounter = 17; - $k = 0; //row colour counter - while ($myrow2 = DB_fetch_array($result)) { - if ($k == 1) { - $RowStarter = '<tr class="EvenTableRows">'; - $k = 0; - } else { - $RowStarter = '<tr class="OddTableRows">'; - $k = 1; - } - echo $RowStarter; - $DisplayPrice = number_format($myrow2['fxprice'], 2); - $DisplayQty = number_format($myrow2['quantity'], 2); - $DisplayNet = number_format($myrow2['fxnet'], 2); - if ($myrow2['discountpercent'] == 0) { - $DisplayDiscount = ''; - } else { - $DisplayDiscount = number_format($myrow2['discountpercent'] * 100, 2) . '%'; - } - printf('<td>%s</td> + <th>' . _('Item Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('Net') . '</th> + </tr>'; + + $LineCounter =17; + $k=0; //row colour counter + + while ($myrow2=DB_fetch_array($result)){ + + if ($k==1){ + $RowStarter = '<tr class="EvenTableRows">'; + $k=0; + } else { + $RowStarter = '<tr class="OddTableRows">'; + $k=1; + } + + echo $RowStarter; + + $DisplayPrice = number_format($myrow2['fxprice'],2); + $DisplayQty = number_format($myrow2['quantity'],2); + $DisplayNet = number_format($myrow2['fxnet'],2); + + if ($myrow2['discountpercent']==0){ + $DisplayDiscount =''; + } else { + $DisplayDiscount = number_format($myrow2['discountpercent']*100,2) . '%'; + } + + printf ('<td>%s</td> <td>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> <td class=number>%s</td> - </tr>', $myrow2['stockid'], $myrow2['description'], $DisplayQty, $myrow2['units'], $DisplayPrice, $DisplayDiscount, $DisplayNet); - if (strlen($myrow2['narrative']) > 1) { - echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; + </tr>', + $myrow2['stockid'], + $myrow2['description'], + $DisplayQty, + $myrow2['units'], + $DisplayPrice, + $DisplayDiscount, + $DisplayNet); + + if (strlen($myrow2['narrative'])>1){ + echo $RowStarter . '<td></td><td colspan=6>' . $myrow2['narrative'] . '</td></tr>'; $LineCounter++; - } - $LineCounter++; - if ($LineCounter == ($_SESSION['PageLength'] - 2)) { - /* head up a new invoice/credit note page */ - $PageNumber++; - echo '</table><table class="table1"><tr><td VALIGN=TOp><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#BBBBBB"><b>'; - if ($InvOrCredit == 'Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; - } else { - echo '<font color=red size=4>' . _('TAX CREDIT NOTE') . ' '; - } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; - /*Now print out company name and address */ - echo '<table class="table1"><tr> - <td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; - echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; - echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; - echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; - echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': '.$PageNumber.'</td></tr></table>'; - echo '<table class="table1"><tr> + } + + $LineCounter++; + + if ($LineCounter == ($_SESSION['PageLength'] - 2)){ + + /* head up a new invoice/credit note page */ + + $PageNumber++; + echo '</table> + <table class="table1"> + <tr><td valign=top><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#BBBBBB"><b>'; + + if ($InvOrCredit=='Invoice') { + echo '<font size=4>' . _('TAX INVOICE') . ' '; + } else { + echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + } + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr></table>'; + + /*Now print out company name and address */ + echo '<table class="table1"><tr> + <td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>'; + echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; + echo '<table class="table1"><tr> <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> <th>' . _('Quantity') . '</th> @@ -715,36 +891,45 @@ <th>' . _('Price') . '</th> <th>' . _('Discount') . '</th> <th>' . _('Net') . '</th></tr>'; - $LineCounter = 10; - } //end if need a new page headed up + $LineCounter = 10; + + } //end if need a new page headed up } //end while there are line items to print out echo '</table>'; } /*end if there are stock movements to show on the invoice or credit note*/ + /* check to see enough space left to print the totals/footer */ - $LinesRequiredForText = floor(strlen($myrow['invtext']) / 140); - if ($LineCounter >= ($_SESSION['PageLength'] - 8 - $LinesRequiredForText)) { + $LinesRequiredForText = floor(strlen($myrow['invtext'])/140); + + if ($LineCounter >= ($_SESSION['PageLength'] - 8 - $LinesRequiredForText)){ + /* head up a new invoice/credit note page */ $PageNumber++; - echo '<table class="table1"><tr><td VALIGN=TOp><img src="' . $_SESSION['LogoFile'] . '"></td><td bgcolor="#BBBBBB"><b>'; - if ($InvOrCredit == 'Invoice') { - echo '<font size=4>' . _('TAX INVOICE') . ' '; + echo '<table class="table1"> + <tr><td valign=top><img src="' . $_SESSION['LogoFile'] . '"></td> + <td bgcolor="#BBBBBB"><b>'; + + if ($InvOrCredit=='Invoice') { + echo '<font size=4>' . _('TAX INVOICE') .' '; } else { - echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; + echo '<font color=RED size=4>' . _('TAX CREDIT NOTE') . ' '; } - echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br /><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr><table>'; + echo '</b>' . _('Number') . ' ' . $FromTransNo . '</font><br><font size=1>' . _('GST Number') . ' - ' . $_SESSION['CompanyRecord']['gstno'] . '</td></tr><table>'; + /* Print out the logo and company name and address */ - echo '<table class="table1"><tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br />'; - echo $_SESSION['CompanyRecord']['regoffice1'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice2'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice3'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice4'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice5'] . '<br />'; - echo $_SESSION['CompanyRecord']['regoffice6'] . '<br />'; - echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br />'; - echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br />'; - echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br />'; - echo '</td><td class=number>' . _('Page') . ': '.$PageNumber.'</td></tr></table>'; + echo '<table class="table1"> + <tr><td><font size=4 color="#333333"><b>' . $_SESSION['CompanyRecord']['coyname'] . '</b></font><br>'; + echo $_SESSION['CompanyRecord']['regoffice1'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice2'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice3'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice4'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice5'] . '<br>'; + echo $_SESSION['CompanyRecord']['regoffice6'] . '<br>'; + echo _('Telephone') . ': ' . $_SESSION['CompanyRecord']['telephone'] . '<br>'; + echo _('Facsimile') . ': ' . $_SESSION['CompanyRecord']['fax'] . '<br>'; + echo _('Email') . ': ' . $_SESSION['CompanyRecord']['email'] . '<br>'; + echo '</td><td class=number>' . _('Page') . ': ' . $PageNumber . '</td></tr></table>'; echo '<table class="table1"><tr> <th>' . _('Item Code') . '</th> <th>' . _('Item Description') . '</th> @@ -753,62 +938,87 @@ <th>' . _('Price') . '</th> <th>' . _('Discount') . '</th> <th>' . _('Net') . '</th></tr>'; + $LineCounter = 10; } + /* Space out the footer to the bottom of the page */ - echo '<br /><br />' . $myrow['invtext']; - $LineCounter = $LineCounter + 2 + $LinesRequiredForText; - while ($LineCounter < ($_SESSION['PageLength'] - 6)) { - echo '<br />'; + + echo '<br><br>' . $myrow['invtext']; + + $LineCounter=$LineCounter+2+$LinesRequiredForText; + while ($LineCounter < ($_SESSION['PageLength'] -6)){ + echo '<br>'; $LineCounter++; } + /* Now print out the footer and totals */ - if ($InvOrCredit == 'Invoice') { - $DisplaySubTot = number_format($myrow['ovamount'], 2); - $DisplayFreight = number_format($myrow['ovfreight'], 2); - $DisplayTax = number_format($myrow['ovgst'], 2); - $DisplayTotal = number_format($myrow['ovfreight'] + $myrow['ovgst'] + $myrow['ovamount'], 2); + + if ($InvOrCredit=='Invoice') { + + $DisplaySubTot = number_format($myrow['ovamount'],2); + $DisplayFreight = number_format($myrow['ovfreight'],2); + $DisplayTax = number_format($myrow['ovgst'],2); + $DisplayTotal = number_format($myrow['ovfreight']+$myrow['ovgst']+$myrow['ovamount'],2); } else { - $DisplaySubTot = number_format(-$myrow['ovamount'], 2); - $DisplayFreight = number_format(-$myrow['ovfreight'], 2); - $DisplayTax = number_format(-$myrow['ovgst'], 2); - $DisplayTotal = number_format(-$myrow['ovfreight'] - $myrow['ovgst'] - $myrow['ovamount'], 2); + $DisplaySubTot = number_format(-$myrow['ovamount'],2); + $DisplayFreight = number_format(-$myrow['ovfreight'],2); + $DisplayTax = number_format(-$myrow['ovgst'],2); + $DisplayTotal = number_format(-$myrow['ovfreight']-$myrow['ovgst']-$myrow['ovamount'],2); } + /*Print out the invoice text entered */ echo '<table class=table1><tr> <td class=number>' . _('Sub Total') . '</td> - <td class=number bgcolor="#EEEEEE" width=15%>'.$DisplaySubTot.'</td></tr>'; + <td class=number bgcolor="#EEEEEE" width=15%>' . $DisplaySubTot . '</td></tr>'; echo '<tr><td class=number>' . _('Freight') . '</td> - <td class=number bgcolor="#EEEEEE">'.$DisplayFreight.'</td></tr>'; + <td class=number bgcolor="#EEEEEE">' . $DisplayFreight . '</td></tr>'; echo '<tr><td class=number>' . _('Tax') . '</td> - <td class=number bgcolor="#EEEEEE">'.$DisplayTax.'</td></tr>'; - if ($InvOrCredit == 'Invoice') { - echo '<tr><td class=number><b>' . _('TOTAL INVOICE') . '</b></td> - <td class=number bgcolor="#EEEEEE"><U><b>'.$DisplayTotal.'</b></U></td></tr>'; + <td class=number bgcolor="#EEEEEE">' . $DisplayTax . '</td></tr>'; + if ($InvOrCredit=='Invoice'){ + echo '<tr><td class=number><b>' . _('TOTAL INVOICE') . '</b></td> + <td class=number bgcolor="#EEEEEE"><U><b>' . $DisplayTotal . '</b></U></td></tr>'; } else { - echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> - <td class=number bgcolor="#EEEEEE"><font color=RED><U><b>'.$DisplayTotal.'</b></U></font></td></tr>'; + echo '<tr><td class=number><font color=RED><b>' . _('TOTAL CREDIT') . '</b></font></td> + <td class=number bgcolor="#EEEEEE"><font color="red"><U><b>' . $DisplayTotal . '</b></U></font></td></tr>'; } echo '</table>'; } /* end of check to see that there was an invoice record to print */ $FromTransNo++; } /* end loop to print invoices */ } /*end of if FromTransNo exists */ - include ('includes/footer.inc'); + include('includes/footer.inc'); } /*end of else not PrintPDF */ -function PrintLinesToBottom($pdf, $Page_Height, $PageNumber, $FormDesign) { + + +function PrintLinesToBottom () { + + global $pdf; + global $PageNumber; + global $TopOfColHeadings; + global $Left_Margin; + global $Bottom_Margin; + global $line_height; + /* draw the vertical column lines right to the bottom */ - $pdf->line($FormDesign->DataLines->Line1->startx, $Page_Height - $FormDesign->DataLines->Line1->starty, $FormDesign->DataLines->Line1->endx, $Page_Height - $FormDesign->DataLines->Line1->endy); + $pdf->line($Left_Margin+97, $TopOfColHeadings+12,$Left_Margin+97,$Bottom_Margin); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line2->startx, $Page_Height - $FormDesign->DataLines->Line2->starty, $FormDesign->DataLines->Line2->endx, $Page_Height - $FormDesign->DataLines->Line2->endy); + $pdf->line($Left_Margin+350, $TopOfColHeadings+12,$Left_Margin+350,$Bottom_Margin); + /* Print a column vertical line */ - $pdf->line($FormDesign->DataLines->Line3->startx, $Page_Height - $FormDe... [truncated message content] |