From: <dai...@us...> - 2011-10-23 05:41:44
|
Revision: 4730 http://web-erp.svn.sourceforge.net/web-erp/?rev=4730&view=rev Author: daintree Date: 2011-10-23 05:41:35 +0000 (Sun, 23 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/GLBudgets.php trunk/GLProfit_Loss.php trunk/GLTagProfit_Loss.php trunk/GLTags.php trunk/GLTransInquiry.php trunk/GLTrialBalance.php trunk/GoodsReceived.php trunk/GoodsReceivedControlled.php trunk/InventoryPlanning.php trunk/InventoryPlanningPrefSupplier.php trunk/InventoryQuantities.php trunk/InventoryValuation.php trunk/MRP.php trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/MRPReport.php trunk/MailInventoryValuation.php trunk/includes/DefineStockAdjustment.php Modified: trunk/GLBudgets.php =================================================================== --- trunk/GLBudgets.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLBudgets.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -184,7 +184,7 @@ for ($i=1; $i<=12; $i++) { echo '<tr>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(24-$i)] .'</th>'; - echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(24-$i)],2).'</td>'; + echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(24-$i)],$_SESSION['CompanyRecord']['decimalplaces']).'</td>'; echo '<td><input type="text" class="number" size=14 name="'.$i.'last" value="'.locale_number_format($Budget[$CurrentYearEndPeriod-(24-$i)],$_SESSION['CompanyRecord']['decimalplaces']) .'" /></td>'; echo '<th>'. $PeriodEnd[$CurrentYearEndPeriod-(12-$i)] .'</th>'; echo '<td bgcolor="d2e5e8" class="number">'.locale_number_format($Actual[$CurrentYearEndPeriod-(12-$i)],$_SESSION['CompanyRecord']['decimalplaces']).'</td>'; Modified: trunk/GLProfit_Loss.php =================================================================== --- trunk/GLProfit_Loss.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLProfit_Loss.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -12,15 +12,21 @@ $_POST['SelectADifferentPeriod']='Select A Different Period'; } -if ((!isset($_POST['FromPeriod']) AND !isset($_POST['ToPeriod'])) OR isset($_POST['SelectADifferentPeriod'])){ +if ((!isset($_POST['FromPeriod']) + AND !isset($_POST['ToPeriod'])) + OR isset($_POST['SelectADifferentPeriod'])){ include('includes/header.inc'); -echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Profit and Loss Report') . '</p>'; -echo '<div class="page_help_text">' . _('Profit and loss statement (P&L), also called an Income Statment, or Statement of Operations, this is the statement that indicates how the revenue (money received from the sale of products and services before expenses are taken out, also known as the "top line") is transformed into the net income (the result after all revenues and expenses have been accounted for, also known as the "bottom line").') . '<br />' -. _('The purpose of the income statement is to show whether the company made or lost money during the period being reported.') . '<br />' -. _('The P&L represents a period of time. This contrasts with the Balance Sheet, which represents a single moment in time.') . '<br />' -. _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.') . '</div>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . _('Print Profit and Loss Report') . ' + </p>'; + echo '<div class="page_help_text">' . _('Profit and loss statement (P&L), also called an Income Statment, or Statement of Operations, this is the statement that indicates how the revenue (money received from the sale of products and services before expenses are taken out, also known as the "top line") is transformed into the net income (the result after all revenues and expenses have been accounted for, also known as the "bottom line").') . + '<br />' + . _('The purpose of the income statement is to show whether the company made or lost money during the period being reported.') . '<br />' + . _('The P&L represents a period of time. This contrasts with the Balance Sheet, which represents a single moment in time.') . '<br />' + . _('webERP is an "accrual" based system (not a "cash based" system). Accrual systems include items when they are invoiced to the customer, and when expenses are owed based on the supplier invoice date.') . '</div>'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -37,7 +43,7 @@ /*Show a form to allow input of criteria for profit and loss to show */ echo '<p><table class="selection"> <tr><td>' . _('Select Period From') . ':</td> - <td><select Name="FromPeriod">'; + <td><select name="FromPeriod">'; $sql = "SELECT periodno, lastdate_in_period @@ -49,20 +55,21 @@ while ($myrow=DB_fetch_array($Periods,$db)){ if(isset($_POST['FromPeriod']) AND $_POST['FromPeriod']!=''){ if( $_POST['FromPeriod']== $myrow['periodno']){ - echo '<option selected value=' . $myrow['periodno'] . '>' .MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option selected value="' . $myrow['periodno'] . '">' .MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } else { - echo '<option value=' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } } else { if($myrow['lastdate_in_period']==$DefaultFromDate){ - echo '<option selected value=' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option selected value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } else { - echo '<option value=' . $myrow['periodno'] . '>' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; + echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; } } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ $LastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); $sql = "SELECT periodno FROM periods where lastdate_in_period = '" . $LastDate . "'"; @@ -90,19 +97,24 @@ } echo '</select></td></tr>'; - echo '<tr><td>'._('Detail Or Summary').':</td> - <td><select name="Detail"> + echo '<tr> + <td>'._('Detail Or Summary').':</td> + <td><select name="Detail"> <option selected value="Summary">'._('Summary') . '</option> <option selected value="Detailed">'._('All Accounts') . '</option> </select> - </td> - </tr>'; + </td> + </tr> + </table> + <br /> + <div class="centre"> + <input type="submit" name="ShowPL" value="' ._('Show on Screen (HTML)') . '" /> + </div> + <br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="'._('Produce PDF Report').'" /> + </div>'; - echo '</table>'; - - echo '<br /><div class="centre"><input type="submit" name="ShowPL" value="' ._('Show on Screen (HTML)') . '"></div>'; - echo '<br /><div class="centre"><input type="submit" name="PrintPDF" value="'._('Produce PDF Report').'"></div>'; - /*Now do the posting while the user is thinking about the period to select */ include ('includes/GLPostings.inc'); @@ -344,7 +356,7 @@ if ($myrow['groupname'] != $ActGrp){ if ($myrow['parentgroupname']==$ActGrp AND $ActGrp !=''){ //adding another level of nesting - $Level++; + $Level++; } $ActGrp = $myrow['groupname']; $ParentGroups[$Level]=$ActGrp; @@ -537,10 +549,10 @@ } else { include('includes/header.inc'); - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '"> - <input type=hidden name="ToPeriod" value="' . $_POST['ToPeriod'] . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" /> + <input type=hidden name="ToPeriod" value="' . $_POST['ToPeriod'] . '" />'; $NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1; @@ -556,7 +568,6 @@ $myrow = DB_fetch_row($PrdResult); $PeriodToDate = MonthAndYearFromSQLDate($myrow[0]); - $SQL = "SELECT accountgroups.sectioninaccounts, accountgroups.parentgroupname, accountgroups.groupname, @@ -568,20 +579,18 @@ SUM(CASE WHEN chartdetails.period='" . ($_POST['FromPeriod'] - 12) . "' THEN chartdetails.bfwd ELSE 0 END) AS lyfirstprdbfwd, SUM(CASE WHEN chartdetails.period='" . ($_POST['ToPeriod']-12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lylastprdcfwd, SUM(CASE WHEN chartdetails.period='" . $_POST['ToPeriod'] . "' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd - FROM chartmaster INNER JOIN accountgroups - ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails - ON chartmaster.accountcode= chartdetails.accountcode - WHERE accountgroups.pandl=1 - GROUP BY accountgroups.sectioninaccounts, + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails + ON chartmaster.accountcode= chartdetails.accountcode + WHERE accountgroups.pandl=1 + GROUP BY accountgroups.sectioninaccounts, accountgroups.parentgroupname, accountgroups.groupname, chartdetails.accountcode, - chartmaster.accountname, - accountgroups.sequenceintb - ORDER BY accountgroups.sectioninaccounts, + chartmaster.accountname + ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, - accountgroups.sequenceintb, chartdetails.accountcode"; $AccountsResult = DB_query($SQL,$db,_('No general ledger accounts were returned by the SQL because'),_('The SQL that failed was')); @@ -591,22 +600,22 @@ /*show a table of the accounts info returned by the SQL Account Code , Account Name , Month Actual, Month Budget, Period Actual, Period Budget */ - echo '<table cellpadding=2 class=selection>'; + echo '<table class="selection">'; if ($_POST['Detail']=='Detailed'){ $TableHeader = '<tr> <th>' . _('Account') . '</th> <th>'._('Account Name') .'</th> - <th colspan=2>' . _('Period Actual') .'</th> - <th colspan=2>' . _('Period Budget') .'</th> - <th colspan=2>' . _('Last Year') . '</th> + <th colspan="2">' . _('Period Actual') .'</th> + <th colspan="2">' . _('Period Budget') .'</th> + <th colspan="2">' . _('Last Year') . '</th> </tr>'; } else { /*summary */ $TableHeader = '<tr> - <th colspan=2></th> - <th colspan=2>' . _('Period Actual') .'</th> - <th colspan=2>' . _('Period Budget') . '</th> - <th colspan=2>' . _('Last Year') . '</th> + <th colspan="2"></th> + <th colspan="2">' . _('Period Actual') .'</th> + <th colspan="2">' . _('Period Budget') . '</th> + <th colspan="2">' . _('Last Year') . '</th> </tr>'; } @@ -643,8 +652,8 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -652,13 +661,13 @@ } if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size="2"><i>%s</i></font></td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -666,12 +675,12 @@ locale_number_format(-$GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class=number>%s</td> + <td colspan="2"><font size=2><i>%s </i></font></td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> </tr>', $ActGrpLabel, @@ -688,8 +697,8 @@ //still need to print out the old group totals if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -698,13 +707,13 @@ if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size=2><i>%s </i></font></td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -712,12 +721,12 @@ locale_number_format(-$GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class=number>%s</td> + <td colspan="2"><font size=2><i>%s </i></font></td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> </tr>', $ActGrpLabel, @@ -740,21 +749,21 @@ echo '<tr> <td colspan=3></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> + <td colspan="2"><font size=4>%s</font></td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -765,21 +774,21 @@ $TotalLYIncome = -$SectionPrdLY; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> + <td colspan="2"></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> + <td colspan="2"><font size=4>%s</font></td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -788,17 +797,17 @@ } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> + <td colspan="2"><font size=4>'._('Gross Profit').'</font></td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($TotalBudgetIncome - $SectionPrdBudget,$_SESSION['CompanyRecord']['decimalplaces']), @@ -820,18 +829,18 @@ $LYGPPercent = 0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"><font size=2><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td></tr>', locale_number_format($PrdGPPercent,1) . '%', locale_number_format($BudgetGPPercent,1) . '%', locale_number_format($LYGPPercent,1). '%'); @@ -846,7 +855,7 @@ if ($_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> + <td colspan="6"><font size=4 color=BLUE><b>%s</b></font></td> </tr>', $Sections[$myrow['sectioninaccounts']]); } @@ -908,11 +917,11 @@ printf('<td>%s</td> <td>%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ActEnquiryURL, $myrow['accountname'], @@ -922,11 +931,11 @@ } else { printf('<td>%s</td> <td>%s</td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> </tr>', $ActEnquiryURL, @@ -947,8 +956,8 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -956,32 +965,32 @@ } if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - </tr>', - $ActGrpLabel, - locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format(-$GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format(-$GrpPrdLY[$Level]),$_SESSION['CompanyRecord']['decimalplaces']); + <td colspan="2"><font size=2><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ActGrpLabel, + locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format(-$GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format(-$GrpPrdLY[$Level]),$_SESSION['CompanyRecord']['decimalplaces']); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - </tr>', - $ActGrpLabel, - locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td colspan="2"><font size=2><i>%s </i></font></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + </tr>', + $ActGrpLabel, + locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($GrpPrdBudget[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } $GrpPrdLY[$Level] = 0; $GrpPrdActual[$Level] = 0; @@ -992,8 +1001,8 @@ //still need to print out the old group totals if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -1002,13 +1011,13 @@ if ($Section ==1){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size=2><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -1016,13 +1025,13 @@ locale_number_format(-$GrpPrdLY[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> </tr>', $ActGrpLabel, locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -1043,21 +1052,21 @@ echo '<tr> <td colspan=3></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size=4>%s</font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -1068,21 +1077,21 @@ $TotalLYIncome = -$SectionPrdLY; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> + <td colspan="2"></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> <td></td> - <td><hr></td> + <td><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size=4>%s</font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), @@ -1091,17 +1100,17 @@ } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> + <td colspan="2"><font size="4">'._('Gross Profit').'</font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($TotalBudgetIncome - $SectionPrdBudget,$_SESSION['CompanyRecord']['decimalplaces']), @@ -1123,18 +1132,18 @@ $LYGPPercent = 0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"><font size=2><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> + <td class="number"><i>%s</i></td> <td></td> - <td class=number><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td></tr>', locale_number_format($PrdGPPercent,1) . '%', locale_number_format($BudgetGPPercent,1) . '%', locale_number_format($LYGPPercent,1). '%'); @@ -1149,7 +1158,7 @@ if ($_POST['Detail']=='Detailed' and isset($Sections[$myrow['sectioninaccounts']])){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> + <td colspan="6"><font size=4 color=BLUE><b>%s</b></font></td> </tr>', $Sections[$myrow['sectioninaccounts']]); } @@ -1158,23 +1167,22 @@ } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr bgcolor="#ffffff"> - <td colspan=2><font size="4" color="blue"><b>'._('Profit').' - '._('Loss').'</b></font></td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="4" color="blue"><b>'._('Profit').' - '._('Loss').'</b></font></td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> </tr>', locale_number_format(-$PeriodProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format(-$PeriodBudgetProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format(-$PeriodLYProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']) - ); + locale_number_format(-$PeriodLYProfitLoss,$_SESSION['CompanyRecord']['decimalplaces']) ); if ($TotalIncome !=0){ $PrdNPPercent = 100*(-$PeriodProfitLoss)/$TotalIncome; @@ -1193,18 +1201,18 @@ } echo '<tr> <td colspan="2"></td> - <td colspan="6"><hr></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan="2"><font size="2"><I>'._('Net Profit Percent').'</I></font></td> - <td></td> - <td class="number"><I>%s</I></td> - <td></td> - <td class="number"><I>%s</I></td> - <td></td> - <td class="number"><I>%s</I></td> - </tr><tr><td colspan="6"> </td> + <td colspan="2"><font size="2"><i>'._('Net Profit Percent').'</i></font></td> + <td></td> + <td class="number"><i>%s</i></td> + <td></td> + <td class="number"><i>%s</i></td> + <td></td> + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td> </tr>', locale_number_format($PrdNPPercent,1) . '%', locale_number_format($BudgetNPPercent,1) . '%', Modified: trunk/GLTagProfit_Loss.php =================================================================== --- trunk/GLTagProfit_Loss.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTagProfit_Loss.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -8,7 +8,7 @@ include('includes/AccountSectionsDef.inc'); // This loads the $Sections variable -if (isset($_POST['FromPeriod']) and ($_POST['FromPeriod'] > $_POST['ToPeriod'])){ +if (isset($_POST['FromPeriod']) AND ($_POST['FromPeriod'] > $_POST['ToPeriod'])){ prnMsg(_('The selected period from is actually after the period to') . '! ' . _('Please reselect the reporting period'),'error'); $_POST['SelectADifferentPeriod']='Select A Different Period'; } @@ -18,8 +18,9 @@ include('includes/header.inc'); 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/printer.png" title="' - . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . ' + </p>'; if (Date('m') > $_SESSION['YearEnd']){ /*Dates in SQL format */ @@ -60,10 +61,11 @@ } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ - $lastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); - $sql = "SELECT periodno FROM periods where lastdate_in_period = '$lastDate'"; + $LastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); + $sql = "SELECT periodno FROM periods where lastdate_in_period = '" . $LastDate . "'"; $MaxPrd = DB_query($sql,$db); $MaxPrdrow = DB_fetch_row($MaxPrd); $DefaultToPeriod = (int) ($MaxPrdrow[0]); @@ -88,7 +90,9 @@ } echo '</select></td></tr>'; //Select the tag - echo '<tr><td>'._('Select tag').'<td><select name="tag">'; + echo '<tr> + <td>'._('Select tag').'</td> + <td><select name="tag">'; $SQL = "SELECT tagref, tagdescription @@ -114,14 +118,15 @@ <option selected value="Detailed">'._('All Accounts') . '</option> </select> </td> - </tr>'; - - echo '</table><br />'; - - echo '<div class="centre"><input type="submit" name="ShowPL" value="'._('Show Statement of Income and Expenditure').'"> + </tr> + </table> <br /> - <br /> - <input type="submit" name="PrintPDF" value="'._('PrintPDF').'" /></div>'; + <div class="centre"> + <input type="submit" name="ShowPL" value="'._('Show Statement of Income and Expenditure').'" /> + <br /> + <br /> + <input type="submit" name="PrintPDF" value="'._('PrintPDF').'" /> + </div>'; /*Now do the posting while the user is thinking about the period to select */ @@ -164,18 +169,18 @@ chartmaster.accountname, Sum(CASE WHEN (gltrans.periodno>='" . $_POST['FromPeriod'] . "' and gltrans.periodno<='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalAllPeriods, Sum(CASE WHEN (gltrans.periodno='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalThisPeriod - FROM chartmaster INNER JOIN accountgroups - ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans - ON chartmaster.accountcode= gltrans.account - WHERE accountgroups.pandl=1 - AND gltrans.tag='" . $_POST['tag'] . "' - GROUP BY accountgroups.sectioninaccounts, + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans + ON chartmaster.accountcode= gltrans.account + WHERE accountgroups.pandl=1 + AND gltrans.tag='" . $_POST['tag'] . "' + GROUP BY accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, gltrans.account, chartmaster.accountname, accountgroups.sequenceintb - ORDER BY accountgroups.sectioninaccounts, + ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, gltrans.account"; @@ -458,10 +463,10 @@ } else { include('includes/header.inc'); - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; - echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" /> - <input type="hidden" name="ToPeriod" value="' . $_POST['ToPeriod'] . '" />'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" /> + <input type="hidden" name="FromPeriod" value="' . $_POST['FromPeriod'] . '" /> + <input type="hidden" name="ToPeriod" value="' . $_POST['ToPeriod'] . '" />'; $NumberOfMonths = $_POST['ToPeriod'] - $_POST['FromPeriod'] + 1; @@ -483,22 +488,21 @@ $SQL = "SELECT accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, - gltrans.account , + gltrans.account, chartmaster.accountname, Sum(CASE WHEN (gltrans.periodno>='" . $_POST['FromPeriod'] . "' AND gltrans.periodno<='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalAllPeriods, Sum(CASE WHEN (gltrans.periodno='" . $_POST['ToPeriod'] . "') THEN gltrans.amount ELSE 0 END) AS TotalThisPeriod - FROM chartmaster INNER JOIN accountgroups - ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans - ON chartmaster.accountcode= gltrans.account - WHERE accountgroups.pandl=1 - AND gltrans.tag='" . $_POST['tag'] . "' - GROUP BY accountgroups.sectioninaccounts, + FROM chartmaster INNER JOIN accountgroups + ON chartmaster.group_ = accountgroups.groupname INNER JOIN gltrans + ON chartmaster.accountcode= gltrans.account + WHERE accountgroups.pandl=1 + AND gltrans.tag='" . $_POST['tag'] . "' + GROUP BY accountgroups.sectioninaccounts, accountgroups.groupname, accountgroups.parentgroupname, gltrans.account, - chartmaster.accountname, - accountgroups.sequenceintb - ORDER BY accountgroups.sectioninaccounts, + chartmaster.accountname + ORDER BY accountgroups.sectioninaccounts, accountgroups.sequenceintb, accountgroups.groupname, gltrans.account"; @@ -515,18 +519,24 @@ . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; echo '<table cellpadding="2" class="selection">'; - echo '<tr><th colspan=9><div class="centre"><font size=3 color=blue><b>' . _('Statement of Income and Expenditure for Tag'). ' ' . $myrow[0]._('during the'). ' ' . $NumberOfMonths . ' ' . _('months to'). ' ' . $PeriodToDate . '</b></font></div></th></tr>'; + echo '<tr> + <th colspan="9"> + <div class="centre"> + <font size="3" color="blue"><b>' . _('Statement of Income and Expenditure for Tag'). ' ' . $myrow[0]._('during the'). ' ' . $NumberOfMonths . ' ' . _('months to'). ' ' . $PeriodToDate . '</b></font> + </div> + </th> + </tr>'; if ($_POST['Detail']=='Detailed'){ $TableHeader = '<tr> <th>' . _('Account') . '</th> <th>' . _('Account Name') . '</th> - <th colspan=2>' . _('Period Actual') . '</th> + <th colspan="2">' . _('Period Actual') . '</th> </tr>'; } else { /*summary */ $TableHeader = '<tr> - <th colspan=2></th> - <th colspan=2>' . _('Period Actual') . '</th> + <th colspan="2"></th> + <th colspan="2">' . _('Period Actual') . '</th> </tr>'; } @@ -551,8 +561,8 @@ $GrpPrdActual = array(0); $GrpPrdLY = array(0); $GrpPrdBudget = array(0); + $TotalIncome =0; - while ($myrow=DB_fetch_array($AccountsResult)) { @@ -561,8 +571,8 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -571,20 +581,20 @@ if ($Section ==3){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class="number">%s</td> - </tr>', - $ActGrpLabel, - locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> + </tr>', + $ActGrpLabel, + locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> - </tr>', - $ActGrpLabel, - locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td class="number">%s</td> + <td></td> + </tr>', + $ActGrpLabel, + locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } $GrpPrdLY[$Level] = 0; $GrpPrdActual[$Level] = 0; @@ -595,8 +605,8 @@ //still need to print out the old group totals if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -605,17 +615,17 @@ if ($Section ==4){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="2"><i>%s </i></font></td> + <td></td> + <td class="number">%s</td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan="2"><font size="2"><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> + <td colspan="2"><font size="2"><i>%s</i></font></td> + <td class="number">%s</td> + <td></td> </tr>', $ActGrpLabel, locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); @@ -632,47 +642,42 @@ if ($Section==4) { /*Income*/ echo '<tr> - <td colspan=3></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> - <td><hr></td> - </tr>'; + <td colspan="2"></td> + <td><hr /></td> + <td></td> + <td><hr /></td> + </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> + <td colspan="2"><font size="4">%s</font></td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); - $TotalIncome = -$SectionPrdActual; + $TotalIncome -= $SectionPrdActual; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> - <td><hr></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="4">%s</font></td> + <td></td> + <td class="number">%s</td> </tr>', $Sections[$Section], locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="5"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> - <td></td> - <td class="number">%s</td> + <td colspan="2"><font size="4">'._('Gross Profit').'</font></td> + <td></td> + <td class="number">%s</td> </tr>', locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); @@ -682,14 +687,14 @@ $PrdGPPercent =0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="6"><hr /></td> </tr>'; printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"><font size="2"><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class="number"><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', + <td class="number"><i>%s</i></td> + </tr><tr><td colspan="6"> </td></tr>', locale_number_format($PrdGPPercent,1) . '%'); $j++; } @@ -700,9 +705,9 @@ if ($_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> - </tr>', - $Sections[$myrow['sectioninaccounts']]); + <td colspan="6"><font size="4" color="blue"><b>%s</b></font></td> + </tr>', + $Sections[$myrow['sectioninaccounts']]); } $j++; @@ -718,10 +723,11 @@ $ActGrp = $myrow['groupname']; if ($_POST['Detail']=='Detailed'){ printf('<tr> - <td colspan=6><font size=2 color=BLUE><b>%s</b></font></td> - </tr>', - $myrow['groupname']); - echo $TableHeader; + <td colspan="6"><font size="2" color="blue"><b>%s</b></font></td> + </tr>', + $myrow['groupname']); + + echo $TableHeader; } } @@ -780,33 +786,24 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0) { if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> + <td colspan="2"></td> + <td colspan="4"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level]; } if ($Section ==4){ /*Income */ - printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + echo '<tr> + <td colspan="2"><font size="2"><i>' . $ActGrpLabel . '</i></font></td> <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - </tr>', - $ActGrpLabel, - locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + <td class="number">' . locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; } else { /*Costs */ - printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> - <td class="number">%s</td> - <td></td> - </tr>', - $ActGrpLabel, - locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); + echo '<tr> + <td colspan="2"><font size="2"><i>' . $ActGrpLabel . '</i></font></td> + <td class="number">' . locale_number_format($GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; } $GrpPrdActual[$Level] = 0; $ParentGroups[$Level] =''; @@ -816,7 +813,7 @@ if ($_POST['Detail']=='Detailed'){ echo '<tr> <td colspan="2"></td> - <td colspan="6"><hr></td> + <td colspan="4"><hr /></td> </tr>'; $ActGrpLabel = str_repeat('___',$Level) . $ParentGroups[$Level] . ' ' . _('total'); } else { @@ -825,7 +822,7 @@ if ($Section ==4){ /*Income */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size="2"><i>%s</i></font></td> <td></td> <td class="number">%s</td> </tr>', @@ -833,7 +830,7 @@ locale_number_format(-$GrpPrdActual[$Level],$_SESSION['CompanyRecord']['decimalplaces'])); } else { /*Costs */ printf('<tr> - <td colspan=2><font size=2><I>%s </I></font></td> + <td colspan="2"><font size="2"><i>%s </i></font></td> <td class="number">%s</td> <td></td> </tr>', @@ -851,54 +848,36 @@ if ($Section==4) { /*Income*/ echo '<tr> - <td colspan=3></td> - <td><hr></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="4">' . $Sections[$Section] . '</font></td> <td></td> - <td><hr></td> - <td></td> - <td><hr></td> + <td class="number">' . locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; - - printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class="number">%s</td> - </tr>', - $Sections[$Section], - locale_number_format($SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); - $TotalIncome = $SectionPrdActual; + $TotalIncome = $SectionPrdActual; } else { echo '<tr> - <td colspan=2></td> - <td><hr></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="4">' . $Sections[$Section] . '</font></td> <td></td> - <td><hr></td> - <td></td> - <td><hr></td> + <td class="number">' . locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> </tr>'; - printf('<tr> - <td colspan=2><font size=4>%s</font></td> - <td></td> - <td class="number">%s</td> - </tr>', - $Sections[$Section], - locale_number_format(-$SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); } if ($Section==2){ /*Cost of Sales - need sub total for Gross Profit*/ echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> - </tr>'; - printf('<tr> - <td colspan=2><font size=4>'._('Gross Profit').'</font></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="4">'._('Gross Profit').'</font></td> <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - <td></td> - <td class="number">%s</td> - </tr>', - locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces'])); + <td class="number">' . locale_number_format($TotalIncome - $SectionPrdActual,$_SESSION['CompanyRecord']['decimalplaces']) . '</td> + </tr>'; if ($TotalIncome !=0){ $PrdGPPercent = 100*($TotalIncome - $SectionPrdActual)/$TotalIncome; @@ -906,19 +885,16 @@ $PrdGPPercent =0; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> - </tr>'; - printf('<tr> - <td colspan=2><font size=2><I>'._('Gross Profit Percent').'</I></font></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> + </tr> + <tr> + <td colspan="2"><font size="2"><i>'._('Gross Profit Percent').'</i></font></td> <td></td> - <td class="number"><I>%s</I></td> + <td class="number"><i>' . locale_number_format($PrdGPPercent,1) . '%</i></td> <td></td> - <td class="number"><I>%s</I></td> - <td></td> - <td class="number"><I>%s</I></td> - </tr><tr><td colspan=6> </td></tr>', - locale_number_format($PrdGPPercent,1) . '%'); + </tr>'; + $j++; } @@ -926,19 +902,18 @@ $Section = $myrow['sectioninaccounts']; - if ($_POST['Detail']=='Detailed' and isset($Sections[$myrow['sectioninaccounts']])){ - printf('<tr> - <td colspan=6><font size=4 color=BLUE><b>%s</b></font></td> - </tr>', - $Sections[$myrow['sectioninaccounts']]); + if ($_POST['Detail']=='Detailed' AND isset($Sections[$myrow['sectioninaccounts']])){ + echo '<tr> + <td colspan="6"><font size="4" color="blue"><b>' . $Sections[$myrow['sectioninaccounts']] . '</b></font></td> + </tr>'; } $j++; } echo '<tr> - <td colspan=2></td> - <td colspan=6><hr /></td> + <td colspan="2"></td> + <td colspan="2"><hr /></td> </tr>'; printf('<tr bgcolor="#ffffff"> @@ -949,12 +924,13 @@ locale_number_format($PeriodProfitLoss,$_SESSION['CompanyRecord']['decimalplaces'])); echo '<tr> - <td colspan=2></td> - <td colspan=6><hr></td> - </tr>'; - - echo '</table>'; - echo '<div class="centre"><input type="submit" name="SelectADifferentPeriod" value="'._('Select A Different Period').'"></div>'; + <td colspan="2"></td> + <td colspan="4"><hr /></td> + </tr> + </table> + <div class="centre"> + <input type="submit" name="SelectADifferentPeriod" value="'._('Select A Different Period').'" /> + </div>'; } echo '</form>'; include('includes/footer.inc'); Modified: trunk/GLTags.php =================================================================== --- trunk/GLTags.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTags.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -11,24 +11,25 @@ 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); + 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'); } + $Description=''; } else { $sql="SELECT tagref, - tagdescription - FROM tags - WHERE tagref='".$_GET['SelectedTag']."'"; + tagdescription + FROM tags + WHERE tagref='".$_GET['SelectedTag']."'"; $result= DB_query($sql,$db); $myrow = DB_fetch_array($result,$db); $ref=$myrow['tagref']; - $Description=$myrow['tagdescription']; + $Description = $myrow['tagdescription']; } } else { $Description=''; @@ -36,50 +37,57 @@ } if (isset($_POST['submit'])) { - $sql = "INSERT INTO tags values(NULL, '".$_POST['Description']."')"; + $sql = "INSERT INTO tags values(NULL, '" . DB_escape_string($_POST['Description']) . "')"; $result= DB_query($sql,$db); } if (isset($_POST['update'])) { - $sql = "UPDATE tags SET tagdescription='".$_POST['Description']. "' + $sql = "UPDATE tags SET tagdescription='".DB_escape_string($_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 '<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 '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<br /> - <table><tr>'; + <table> + <tr> + <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'].'">'; - -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'].'">'; - 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') . '" />'; } -echo '</td></tr></table><p></p>'; - -echo '</form>'; - -echo '<table class="selection">'; -echo '<tr> +echo '</td> + </tr> + </table> + <p /> + </form> + <table class="selection"> + <tr> <th>'. _('Tag ID') .'</th> <th>'. _('Description'). '</th> - </tr>'; + </tr>'; -$sql="SELECT tagref, tagdescription FROM tags order by tagref"; +$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['tagref'].'</td> - <td>' . $myrow['tagdescription'].'</td> + 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" onclick="return confirm(\'' . _('Are you sure you wish to delete this GL tag?') . '\');">' . _('Delete') . '</a></td> </tr>'; Modified: trunk/GLTransInquiry.php =================================================================== --- trunk/GLTransInquiry.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTransInquiry.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -34,9 +34,11 @@ // echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Print') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<table class=selection>'; //Main table - echo '<tr><th colspan=7><font size=3 color=blue><b>' . $TransName . ' ' . $_GET['TransNo'] . '</b></font></th></tr>'; + echo '<table class="selection">'; //Main table echo '<tr> + <th colspan="7"><font size="3" color="blue"><b>' . $TransName . ' ' . $_GET['TransNo'] . '</b></font></th> + </tr> + <tr> <th>' . _('Date') . '</th> <th>' . _('Period') .'</th> <th>'. _('GL Account') .'</th> @@ -88,14 +90,13 @@ $date = '&TransAfterDate=' . $TranDate; $DetailSQL = "SELECT debtortrans.debtorno, - debtortrans.ovamount, - debtortrans.ovgst, - debtortrans.rate, - debtorsmaster.name - FROM debtortrans, - debtorsmaster - WHERE debtortrans.debtorno = debtorsmaster.debtorno - AND debtortrans.type = '" . $TransRow['type'] . "' + debtortrans.ovamount, + debtortrans.ovgst, + debtortrans.rate, + debtorsmaster.name + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno = debtorsmaster.debtorno + WHERE debtortrans.type = '" . $TransRow['type'] . "' AND debtortrans.transno = '" . $_GET['TransNo']. "'"; $DetailResult = DB_query($DetailSQL,$db); } elseif ( $TransRow['account'] == $_SESSION['CompanyRecord']['creditorsact'] ) { @@ -103,14 +104,13 @@ $date = '&FromDate=' . $TranDate; $DetailSQL = "SELECT supptrans.supplierno, - supptrans.ovamount, - supptrans.ovgst, - supptrans.rate, - suppliers.suppname - FROM supptrans, - suppliers - WHERE supptrans.supplierno = suppliers.supplierid - AND supptrans.type = '" . $TransRow['type'] . "' + supptrans.ovamount, + supptrans.ovgst, + supptrans.rate, + suppliers.suppname + FROM supptrans INNER JOIN suppliers + ON supptrans.supplierno = suppliers.supplierid + WHERE supptrans.type = '" . $TransRow['type'] . "' AND supptrans.transno = '" . $_GET['TransNo'] . "'"; $DetailResult = DB_query($DetailSQL,$db); } else { @@ -120,7 +120,6 @@ $TransRow['narrative'] = ' '; } - if ($j==1) { echo '<tr class="OddTableRows">'; $j=0; @@ -180,17 +179,20 @@ DB_free_result($TransResult); echo '<tr bgcolor="#FFFFFF"> - <td class="number" colspan=3><b>' . _('Total') . '</b></td> + <td class="number" colspan="3"><b>' . _('Total') . '</b></td> <td class="number">' . locale_number_format(($DebitTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> <td class="number">' . locale_number_format((-$CreditTotal),$_SESSION['CompanyRecord']['decimalplaces']) . '</td> - <td colspan=2> </td> + <td colspan="2"> </td> </tr>'; echo '</table><p>'; } } -echo '</td></tr></table>'; +echo '</td> + </tr> + </table>'; + include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/GLTrialBalance.php =================================================================== --- trunk/GLTrialBalance.php 2011-10-22 05:19:43 UTC (rev 4729) +++ trunk/GLTrialBalance.php 2011-10-23 05:41:35 UTC (rev 4730) @@ -13,15 +13,22 @@ include('includes/AccountSectionsDef.inc'); //this reads in the Accounts Sections array -if (isset($_POST['FromPeriod']) and isset($_POST['ToPeriod']) and $_POST['FromPeriod'] > $_POST['ToPeriod']){ +if (isset($_POST['FromPeriod']) + AND isset($_POST['ToPeriod']) + AND $_POST['FromPeriod'] > $_POST['ToPeriod']){ + prnMsg(_('The selected period from is actually after the period to! Please re-select the reporting period'),'error'); $_POST['SelectADifferentPeriod']=_('Select A Different Period'); } -if ((! isset($_POST['FromPeriod']) AND ! isset($_POST['ToPeriod'])) OR isset($_POST['SelectADifferentPeriod'])){ +if ((! isset($_POST['FromPeriod']) + AND ! isset($_POST['ToPeriod'])) + OR isset($_POST['SelectADifferentPeriod'])){ include ('includes/header.inc'); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Trial Balance') . '" alt="" />' . ' ' . $title . '</p>'; + echo '<p class="page_title_text"> + <img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Trial Balance') . '" alt="" />' . ' ' . $title . ' + </p>'; echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -65,7 +72,8 @@ } } - echo '</select></td></tr>'; + echo '</select></td> + </tr>'; if (!isset($_POST['ToPeriod']) OR $_POST['ToPeriod']==''){ $lastDate = date('Y-m-d',mktime(0,0,0,Date('m')+1,0,Date('Y'))); $sql = "SELECT periodno @@ -98,8 +106,10 @@ </table> <br />'; - echo '<div class="centre"><input type=submit Name="ShowTB" Value="' . _('Show Trial Balance') .'">'; - echo '<input type="submit" name="PrintPDF" value="'._('PrintPDF').'"></div>'; + echo '<div class="centre"> + <input type="submit" Name="ShowTB" value="' . _('Show Trial Balance') .'" /> + <input type="submit" name="PrintPDF" val... [truncated message content] |