From: <dai...@us...> - 2011-10-11 09:10:25
|
Revision: 4718 http://web-erp.svn.sourceforge.net/web-erp/?rev=4718&view=rev Author: daintree Date: 2011-10-11 09:10:13 +0000 (Tue, 11 Oct 2011) Log Message: ----------- number_formats Modified Paths: -------------- trunk/Areas.php trunk/GLBalanceSheet.php trunk/SelectSalesOrder.php trunk/Shipments.php trunk/Shippers.php trunk/Shipt_Select.php Modified: trunk/Areas.php =================================================================== --- trunk/Areas.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Areas.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -195,9 +195,13 @@ $_POST['AreaCode'] = $myrow['areacode']; $_POST['AreaDescription'] = $myrow['areadescription']; - echo '<input type=hidden name=SelectedArea value="' . $SelectedArea . '">'; - echo '<input type=hidden name=AreaCode value="' .$_POST['AreaCode'] . '">'; - echo '<table class=selection><tr><td>' . _('Area Code') . ':</td><td>' . $_POST['AreaCode'] . '</td></tr>'; + echo '<input type=hidden name="SelectedArea" value="' . $SelectedArea . '" />'; + echo '<input type=hidden name="AreaCode" value="' .$_POST['AreaCode'] . '" />'; + echo '<table class="selection"> + <tr> + <td>' . _('Area Code') . ':</td> + <td>' . $_POST['AreaCode'] . '</td> + </tr>'; } else { if (!isset($_POST['AreaCode'])) { @@ -209,16 +213,23 @@ echo '<table class="selection"> <tr> <td>' . _('Area Code') . ':</td> - <td><input tabindex="1" ' . (in_array('AreaCode',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="AreaCode" value="' . $_POST['AreaCode'] . '" size=3 maxlength=3></td> + <td><input tabindex="1" ' . (in_array('AreaCode',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="AreaCode" value="' . $_POST['AreaCode'] . '" size="3" maxlength=3></td> </tr>'; } echo '<tr><td>' . _('Area Name') . ':</td> - <td><input tabindex="2" ' . (in_array('AreaDescription',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="AreaDescription" value="' . $_POST['AreaDescription'] .'" size=26 maxlength=25></td> + <td><input tabindex="2" ' . (in_array('AreaDescription',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="AreaDescription" value="' . $_POST['AreaDescription'] .'" size="26" maxlength="25" /></td> </tr>'; - echo '<tr><td colspan=2><div class="centre"><input tabindex="3" type="submit" name="submit" value=' . _('Enter Information') .'></div></td></tr>'; - echo '</table></form>'; + echo '<tr> + <td colspan="2"> + <div class="centre"> + <input tabindex="3" type="submit" name="submit" value=' . _('Enter Information') .' /> + </div> + </td> + </tr> + </table> + </form>'; } //end if record deleted no point displaying form to add record Modified: trunk/GLBalanceSheet.php =================================================================== --- trunk/GLBalanceSheet.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/GLBalanceSheet.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -1,12 +1,9 @@ <?php -/* $Revision: 1.21 $ */ - /* $Id$*/ /*Through deviousness and cunning, this system allows shows the balance sheets as at the end of any period selected - so first off need to show the input of criteria screen while the user is selecting the period end of the balance date meanwhile the system is posting any unposted transactions */ -//$PageSecurity = 8; include ('includes/session.inc'); $title = _('Balance Sheet'); @@ -24,9 +21,12 @@ . _('The balance sheet has three parts: assets, liabilities and ownership equity. The main categories of assets are listed first and are followed by the liabilities. The difference between the assets and the liabilities is known as equity or the net assets or the net worth or capital of the company and according to the accounting equation, net worth must equal assets minus liabilities.') . '<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 '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class="selection"><tr><td>'._('Select the balance date').':</td><td><select Name="BalancePeriodEnd">'; + echo '<table class="selection"> + <tr> + <td>'._('Select the balance date').':</td> + <td><select Name="BalancePeriodEnd">'; $periodno=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db); $sql = "SELECT lastdate_in_period FROM periods WHERE periodno='".$periodno . "'"; @@ -34,28 +34,38 @@ $myrow=DB_fetch_array($result, $db); $lastdate_in_period=$myrow[0]; - $sql = 'SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC'; + $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC"; $Periods = DB_query($sql,$db); while ($myrow=DB_fetch_array($Periods,$db)){ if( $myrow['periodno']== $periodno){ - echo '<option selected value=' . $myrow['periodno'] . '>' . ConvertSQLDate($lastdate_in_period); + echo '<option selected value=' . $myrow['periodno'] . '>' . ConvertSQLDate($lastdate_in_period) . '</option>'; } else { - echo '<option value=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']); + echo '<option value=' . $myrow['periodno'] . '>' . ConvertSQLDate($myrow['lastdate_in_period']) . '</option>'; } } echo '</select></td></tr>'; - echo '<tr><td>'._('Detail Or Summary').':</td><td><select Name="Detail">'; - echo '<option selected VALUE="Summary">'._('Summary') . '</option>'; - echo '<option selected VALUE="Detailed">'._('All Accounts') . '</option>'; - echo '</select></td></tr>'; + echo '<tr> + <td>'._('Detail Or Summary').':</td> + <td><select Name="Detail"> + <option value="Summary">'._('Summary') . '</option> + <option selected value="Detailed">'._('All Accounts') . '</option> + </select></td> + </tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type=submit Name="ShowBalanceSheet" Value="'._('Show on Screen (HTML)').'"></div>'; - echo '<br /><div class="centre"><input type=submit Name="PrintPDF" Value="'._('Produce PDF Report').'"></div></form>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="ShowBalanceSheet" value="'._('Show on Screen (HTML)').'" /> + </div>'; + echo '<br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="'._('Produce PDF Report').'"> + </div> + </form>'; /*Now do the posting while the user is thinking about the period to select */ include ('includes/GLPostings.inc'); @@ -90,7 +100,8 @@ $title = _('Balance Sheet') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg( _('The accumulated profits brought forward could not be calculated by the SQL because') . ' - ' . DB_error_msg($db) ); - echo '<br /><a href="' .$rootpath .'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; + echo '<br /> + <a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; if ($debug==1){ echo '<br />'. $SQL; } @@ -128,7 +139,7 @@ $title = _('Balance Sheet') . ' - ' . _('Problem Report') . '....'; include('includes/header.inc'); prnMsg( _('No general ledger accounts were returned by the SQL because') . ' - ' . DB_error_msg($db) ); - echo '<br /><a href="' .$rootpath .'/index.php?' . SID . '">'. _('Back to the menu'). '</a>'; + echo '<br /><a href="' .$rootpath .'/index.php">'. _('Back to the menu'). '</a>'; if ($debug==1){ echo '<br />'. $SQL; } @@ -254,26 +265,26 @@ $FontSize = 8; $pdf->setFont('','B'); while ($Level>0) { - $YPos -= $line_height; - $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); - $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $ParentGroups[$Level]=''; - $GroupTotal[$Level]=0; - $LYGroupTotal[$Level]=0; - $Level--; - } - $YPos -= $line_height; - $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); - $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); - $ParentGroups[$Level]=''; - $GroupTotal[$Level]=0; - $LYGroupTotal[$Level]=0; - $YPos -= $line_height; + $YPos -= $line_height; + $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); + $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $ParentGroups[$Level]=''; + $GroupTotal[$Level]=0; + $LYGroupTotal[$Level]=0; + $Level--; + } + $YPos -= $line_height; + $LeftOvers = $pdf->addTextWrap($Left_Margin+(10 * ($Level+1)),$YPos,200,$FontSize,_('Total') . ' ' . $ParentGroups[$Level]); + $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+350,$YPos,100,$FontSize,locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']),'right'); + $ParentGroups[$Level]=''; + $GroupTotal[$Level]=0; + $LYGroupTotal[$Level]=0; + $YPos -= $line_height; - if ($SectionBalanceLY+$SectionBalance !=0){ - $FontSize =8; + if ($SectionBalanceLY+$SectionBalance !=0){ + $FontSize =8; $pdf->setFont('','B'); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,200,$FontSize,$Sections[$Section]); $LeftOvers = $pdf->addTextWrap($Left_Margin+250,$YPos,100,$FontSize,locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']),'right'); @@ -295,15 +306,15 @@ include('includes/footer.inc'); exit; } else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_GL_Balance_Sheet_' . date('Y-m-d') . '.pdf');//UldisN - $pdf->__destruct(); //UldisN + $pdf->OutputD($_SESSION['DatabaseName'] . '_GL_Balance_Sheet_' . date('Y-m-d') . '.pdf'); + $pdf->__destruct(); } exit; } else { include('includes/header.inc'); - echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">'; + echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<input type=hidden name="BalancePeriodEnd" VALUE="' . $_POST['BalancePeriodEnd'] . '">'; + echo '<input type=hidden name="BalancePeriodEnd" value="' . $_POST['BalancePeriodEnd'] . '" />'; $RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings']; @@ -350,22 +361,29 @@ $AccountsResult = DB_query($SQL,$db,_('No general ledger accounts were returned by the SQL because')); echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/preview.gif" title="' . _('Search') . '" alt="" /> ' . _('HTML View') . '</p>'; - echo '<div class=invoice><table class="selection"><tr><th colspan=6><div class="centre"><font size=4 color=blue><b>' . - _('Balance Sheet as at') . ' ' . $BalanceDate .'</b></font></div></th></tr>'; + echo '<div class="invoice"> + <table class="selection"> + <tr> + <th colspan=6> + <div class="centre"><font size="4" color="blue"><b>' . + _('Balance Sheet as at') . ' ' . $BalanceDate .'</b></font> + </div> + </th> + </tr>'; if ($_POST['Detail']=='Detailed'){ $TableHeader = '<tr> - <th>'._('Account').'</td> - <th>'._('Account Name').'</td> - <th colspan=2>$BalanceDate</th> - <th colspan=2>'._('Last Year').'</th> - </tr>'; + <th>'._('Account').'</td> + <th>'._('Account Name').'</td> + <th colspan="2">' . $BalanceDate . '</th> + <th colspan="2">'._('Last Year').'</th> + </tr>'; } else { /*summary */ $TableHeader = '<tr> - <th colspan=2></th> - <th colspan=2>$BalanceDate</th> - <th colspan=2>'._('Last Year').'</th> - </tr>'; + <th colspan="2"></th> + <th colspan="2">' . $BalanceDate . '</th> + <th colspan="2">' ._('Last Year') . '</th> + </tr>'; } @@ -401,22 +419,22 @@ while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0){ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> + <td colspan="2"></td> <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2><I>%s</I></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', - $ParentGroups[$Level], - locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) - ); + printf('<td colspan="2"><I>%s</I></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ParentGroups[$Level], + locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) + ); $GroupTotal[$Level] = 0; $LYGroupTotal[$Level] = 0; $ParentGroups[$Level]=''; @@ -425,23 +443,23 @@ } if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2>%s</td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', - $ParentGroups[$Level], - locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) - ); + printf('<td colspan="2">%s</td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ParentGroups[$Level], + locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) ); + $GroupTotal[$Level] = 0; $LYGroupTotal[$Level] = 0; $ParentGroups[$Level]=''; @@ -453,27 +471,27 @@ if ($Section!=''){ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> - </tr>'; + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> + </tr>'; } else { echo '<tr> - <td colspan=3></td> - <td><hr></td> - <td></td> - <td><hr></td> - </tr>'; + <td colspan="3"></td> + <td><hr></td> + <td></td> + <td><hr></td> + </tr>'; } printf('<tr> - <td colspan=3><font size=4>%s</font></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', + <td colspan="3"><font size="4">%s</font></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', $Sections[$Section], locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($SectionBalanceLY,$_SESSION['CompanyRecord']['decimalplaces'])); @@ -486,9 +504,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']]); } } @@ -501,9 +519,9 @@ if ($_POST['Detail']=='Detailed'){ $ActGrp = $myrow['groupname']; printf('<tr> - <td colspan=6><font size=2 color=BLUE><b>%s</b></font></td> - </tr>', - $myrow['groupname']); + <td colspan="6"><font size="2" color="blue"><b>%s</b></font></td> + </tr>', + $myrow['groupname']); echo $TableHeader; } $GroupTotal[$Level]=0; @@ -535,63 +553,57 @@ $ActEnquiryURL = '<a href="' . $rootpath . '/GLAccountInquiry.php?Period=' . $_POST['BalancePeriodEnd'] . '&Account=' . $myrow['accountcode'] . '">' . $myrow['accountcode'] . '</a>'; - $PrintString = '<td>%s</td> + 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> - </tr>'; - - printf($PrintString, - $ActEnquiryURL, - $myrow['accountname'], - locale_number_format($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYAccountBalance,$_SESSION['CompanyRecord']['decimalplaces']) - ); + </tr>', + $ActEnquiryURL, + $myrow['accountname'], + locale_number_format($AccountBalance,$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYAccountBalance,$_SESSION['CompanyRecord']['decimalplaces'])); $j++; - } - } //end of loop - while ($myrow['groupname']!=$ParentGroups[$Level] AND $Level>0){ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2><I>%s</I></td> - <td class=number>%s</td> - <td></td> - <td class=number>%s</td> - </tr>', - $ParentGroups[$Level], - locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) - ); + printf('<td colspan="2"><I>%s</I></td> + <td class="number">%s</td> + <td></td> + <td class="number">%s</td> + </tr>', + $ParentGroups[$Level], + locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($LYGroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']) + ); $Level--; } if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> - <td><hr></td> - <td></td> - <td><hr></td> - <td></td> + <td colspan="2"></td> + <td><hr></td> + <td></td> + <td><hr></td> + <td></td> </tr>'; } - printf('<td colspan=2>%s</td> - <td class=number>%s</td> + printf('<td colspan="2">%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', $ParentGroups[$Level], locale_number_format($GroupTotal[$Level],$_SESSION['CompanyRecord']['decimalplaces']), @@ -600,7 +612,7 @@ if ($_POST['Detail']=='Detailed'){ echo '<tr> - <td colspan=2></td> + <td colspan="2"></td> <td><hr></td> <td></td> <td><hr></td> @@ -617,50 +629,50 @@ printf('<tr> <td colspan=3><font size=4>%s</font></td> - <td class=number>%s</td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> - </tr>', - $Sections[$Section], - locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']), - locale_number_format($SectionBalanceLY,$_SESSION['CompanyRecord']['decimalplaces'])); + <td class="number">%s</td> + </tr>', + $Sections[$Section], + locale_number_format($SectionBalance,$_SESSION['CompanyRecord']['decimalplaces']), + locale_number_format($SectionBalanceLY,$_SESSION['CompanyRecord']['decimalplaces'])); $Section = $myrow['sectioninaccounts']; if (isset($myrow['sectioninaccounts']) and $_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']]); } echo '<tr> - <td colspan=3></td> + <td colspan="3"></td> <td><hr></td> - <td></td> - <td><hr></td> + <td></td> + <td><hr></td> </tr>'; printf('<tr> - <td colspan=3>'._('Check Total').'</font></td> - <td class=number>%s</td> + <td colspan="3">'._('Check Total').'</font></td> + <td class="number">%s</td> <td></td> - <td class=number>%s</td> + <td class="number">%s</td> </tr>', locale_number_format($CheckTotal,$_SESSION['CompanyRecord']['decimalplaces']), locale_number_format($LYCheckTotal,$_SESSION['CompanyRecord']['decimalplaces'])); echo '<tr> - <td colspan=3></td> - <td><hr></td> + <td colspan="3"></td> + <td><hr></td> <td></td> <td><hr></td> </tr>'; echo '</table>'; - echo '<br /><div class="centre"><input type=submit Name="SelectADifferentPeriod" Value="'._('Select A Different Balance Date').'"></div>'; + echo '<br /><div class="centre"><input type="submit" name="SelectADifferentPeriod" value="'._('Select A Different Balance Date').'" /></div>'; } echo '</form>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/SelectSalesOrder.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -65,7 +65,7 @@ $ItemArray = array(); while ($myrow = DB_fetch_array($ItemResult)){ - $ItemArray[] = $myrow; + $ItemArray[$myrow['stockid']] = $myrow; } /* Now figure out if there are any components of Assembly items that need to be ordered too */ @@ -116,9 +116,27 @@ /* add any assembly item components from salesorders to the ItemArray */ while ($myrow = DB_fetch_array($ItemResult)){ - $ItemArray[] = $myrow; + if (isset($ItemArray[$myrow['stockid']])){ + /* if the item is already in the ItemArray then just add the quantity to the existing item */ + $ItemArray[$myrow['stockid']]['orderqty'] += $myrow['orderqty']; + } else { /*it is not already in the ItemArray so add it */ + $ItemArray[$myrow['stockid']] = $myrow; + } } + + /* We need the items to order to be in supplier order so that only a single order is created for a supplier - so need to sort the multi-dimensional array to ensure it is listed by supplier sequence. To use array_multisort we need to get arrays of supplier with the same keys as the main array of rows + */ + foreach ($ItemArray as $key => $row) { + //to make the Supplier array with the keys of the $ItemArray + $SupplierArray[$key] = $row['supplierno']; + } + + /* Use array_multisort to Sort the ItemArray with supplierno ascending + Add $ItemArray as the last parameter, to sort by the common key + */ + array_multisort($SupplierArray, SORT_ASC, $ItemArray); + if (count($ItemArray)==0){ prnMsg(_('There might be no supplier purchasing data set up for any items on the selected sales order(s). No purchase orders have been created'),'warn'); } else { Modified: trunk/Shipments.php =================================================================== --- trunk/Shipments.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Shipments.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -251,6 +251,7 @@ purchorderdetails.quantityrecd, purchorderdetails.deliverydate, stockmaster.units, + stockmaster.decimalplaces, purchorderdetails.qtyinvoiced FROM purchorderdetails INNER JOIN stockmaster ON purchorderdetails.itemcode=stockmaster.stockid @@ -268,17 +269,17 @@ } $_SESSION['Shipment']->add_to_shipment($_GET['Add'], - $myrow['orderno'], - $myrow['itemcode'], - $myrow['itemdescription'], - $myrow['qtyinvoiced'], - $myrow['unitprice'], - $myrow['units'], - $myrow['deliverydate'], - $myrow['quantityord'], - $myrow['quantityrecd'], - $StandardCost, - $db); + $myrow['orderno'], + $myrow['itemcode'], + $myrow['itemdescription'], + $myrow['qtyinvoiced'], + $myrow['unitprice'], + $myrow['units'], + $myrow['deliverydate'], + $myrow['quantityord'], + $myrow['quantityrecd'], + $StandardCost, + $db); } if (isset($_GET['Delete']) AND $_SESSION['Shipment']->Closed==0){ //shipment is open and user hit delete on a line @@ -312,7 +313,7 @@ echo '<tr><td>'. _('Expected Arrival Date (ETA)'). ': </td>'; if (isset($_SESSION['Shipment']->ETA)) { - echo '<td><input type="text class="date" alt='.$_SESSION['DefaultDateFormat'].' name="ETA" maxlength=10 size=10 value="' . $ETA . '" /></td>'; + echo '<td><input type="text class="date" alt='.$_SESSION['DefaultDateFormat'].' name="ETA" maxlength="10" size="10" value="' . $ETA . '" /></td>'; } else { echo '<td><input type="text class="date" alt='.$_SESSION['DefaultDateFormat'].' name="ETA" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat']) . '" /></td>'; } @@ -382,7 +383,7 @@ /* Always display all shipment lines */ echo '<br /><table cellpadding=2 colspan=7 class="selection">'; - echo '<tr><th colspan=9><font color=navy size=3>'. _('Order Lines On This Shipment'). '</font></th></tr>'; + echo '<tr><th colspan="9"><font color="navy" size="3">'. _('Order Lines On This Shipment'). '</font></th></tr>'; $TableHeader = '<tr> <th>'. _('Order'). '</th> @@ -419,19 +420,22 @@ echo '<td>'.$LnItm->OrderNo.'</td> - <td>'. $LnItm->StockID .' - '. $LnItm->ItemDescription. '</td><td class=number>' . locale_number_format($LnItm->QuantityOrd,2) . '</td> + <td>'. $LnItm->StockID .' - '. $LnItm->ItemDescription. '</td><td class="number">' . locale_number_format($LnItm->QuantityOrd,2) . '</td> <td>'. $LnItm->UOM .'</td> - <td class=number>' . locale_number_format($LnItm->QuantityRecd,2) . '</td> - <td class=number>' . locale_number_format($LnItm->QtyInvoiced,2) . '</td> - <td class=number>' . locale_number_format($LnItm->UnitPrice,2) . '</td> - <td class=number>' . locale_number_format($LnItm->StdCostUnit,2) . '</td> + <td class="number">' . locale_number_format($LnItm->QuantityRecd,2) . '</td> + <td class="number">' . locale_number_format($LnItm->QtyInvoiced,2) . '</td> + <td class="number">' . locale_number_format($LnItm->UnitPrice,2) . '</td> + <td class="number">' . locale_number_format($LnItm->StdCostUnit,2) . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?Delete=' . $LnItm->PODetailItem . '">'. _('Delete'). '</a></td> </tr>'; }//for each line on the shipment echo '</table>'; }//there are lines on the shipment -echo '<br /><div class="centre"><input type=submit name="Update" value="'. _('Update Shipment Details') . '" /></div><p>'; +echo '<br /> + <div class="centre"> + <input type="submit" name="Update" value="'. _('Update Shipment Details') . '" /> + </div>'; if (!isset($_POST['StockLocation'])) { $_POST['StockLocation'] =$_SESSION['Shipment']->StockLocation; @@ -445,7 +449,8 @@ purchorderdetails.quantityord, purchorderdetails.quantityrecd, purchorderdetails.deliverydate, - stockmaster.units + stockmaster.units, + stockmaster.decimalplaces FROM purchorderdetails INNER JOIN purchorders ON purchorderdetails.orderno=purchorders.orderno INNER JOIN stockmaster @@ -496,10 +501,10 @@ echo '<td>' . $myrow['orderno'] . '</td> <td>' . $myrow['itemcode'] . ' - ' . $myrow['itemdescription'] . '</td> - <td class=number>' . locale_number_format($myrow['quantityord'],2) . '</td> + <td class="number">' . locale_number_format($myrow['quantityord'],$myrow['decimalplaces']) . '</td> <td>' . $myrow['units'] . '</td> - <td class=number>' . locale_number_format($myrow['quantityrecd'],2) . '</td> - <td class=number>' . ConvertSQLDate($myrow['deliverydate']) . '</td> + <td class="number">' . locale_number_format($myrow['quantityrecd'],,$myrow['decimalplaces']) . '</td> + <td class="number">' . ConvertSQLDate($myrow['deliverydate']) . '</td> <td><a href="' . $_SERVER['PHP_SELF'] . '?' . 'Add=' . $myrow['podetailitem'] . '">'. _('Add').'</a></td> </tr>'; Modified: trunk/Shippers.php =================================================================== --- trunk/Shippers.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Shippers.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -32,12 +32,12 @@ if (mb_strlen($_POST['ShipperName']) >40) { $InputError = 1; - prnMsg( _("The shipper's name must be forty characters or less long"), 'error'); + prnMsg( _('The shipper\'s name must be forty characters or less long'), 'error'); $Errors[$i] = 'ShipperName'; $i++; } elseif( trim($_POST['ShipperName']) == '' ) { $InputError = 1; - prnMsg( _("The shipper's name may not be empty"), 'error'); + prnMsg( _('The shipper\'s name may not be empty'), 'error'); $Errors[$i] = 'ShipperName'; $i++; } @@ -48,13 +48,13 @@ would not run in this case cos submit is false of course see the delete code below*/ - $sql = "UPDATE shippers SET shippername='" . $_POST['ShipperName'] . "' WHERE shipper_id = '".$SelectedShipper."'"; + $sql = "UPDATE shippers SET shippername='" . DB_escape_string($_POST['ShipperName']) . "' WHERE shipper_id = '".$SelectedShipper."'"; $msg = _('The shipper record has been updated'); } elseif ($InputError !=1) { /*SelectedShipper is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new Shipper form */ - $sql = "INSERT INTO shippers (shippername) VALUES ('" . $_POST['ShipperName'] . "')"; + $sql = "INSERT INTO shippers (shippername) VALUES ('" . DB_escape_string($_POST['ShipperName']) . "')"; $msg = _('The shipper record has been added'); } @@ -126,7 +126,7 @@ $sql = "SELECT * FROM shippers ORDER BY shipper_id"; $result = DB_query($sql,$db); - echo '<table class=selection> + echo '<table class="selection"> <tr><th>'. _('Shipper ID'). '</th><th>'. _('Shipper Name'). '</th></tr>'; $k=0; //row colour counter @@ -141,13 +141,13 @@ } printf('<td>%s</td> <td>%s</td> - <td><a href="%sSelectedShipper=%s">'. _('Edit').' </td> - <td><a href="%sSelectedShipper=%s&delete=1">'. _('Delete'). '</td></tr>', + <td><a href="%sSelectedShipper=%s">'. _('Edit').'</a></td> + <td><a href="%sSelectedShipper=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this shipper?') . '\');">'. _('Delete'). '</a></td></tr>', $myrow[0], $myrow[1], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?' , $myrow[0], - $_SERVER['PHP_SELF'] . "?" . SID, + $_SERVER['PHP_SELF'] . '?', $myrow[0]); } //END WHILE LIST LOOP @@ -158,12 +158,12 @@ if (isset($SelectedShipper)) { echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Search') . '" alt="" />' . ' ' . $title . '</p>'; - echo '<div class="centre"><a href="'.$_SERVER['PHP_SELF'] . '?' . SID.'">'._('REVIEW RECORDS').'</a></div>'; + echo '<div class="centre"><a href="'.$_SERVER['PHP_SELF'] . '">'._('REVIEW RECORDS').'</a></div>'; } if (!isset($_GET['delete'])) { - 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'] . '" />'; if (isset($SelectedShipper)) { @@ -179,21 +179,26 @@ echo '<input type=hidden name="SelectedShipper" VALUE='. $SelectedShipper .'>'; echo '<input type=hidden name="Shipper_ID" VALUE=' . $_POST['Shipper_ID'] . '>'; - echo '<br /><table class=selection><tr><td>'. _('Shipper Code').':</td><td>' . $_POST['Shipper_ID'] . '</td></tr>'; + echo '<br /><table class="selection"><tr><td>'. _('Shipper Code').':</td><td>' . $_POST['Shipper_ID'] . '</td></tr>'; } else { - echo "<br /><table class=selection>"; + echo '<br /> + <table class="selection">'; } if (!isset($_POST['ShipperName'])) { $_POST['ShipperName']=''; } echo '<tr><td>'. _('Shipper Name') .':</td> - <td><input type="Text" name="ShipperName"'. (in_array('ShipperName',$Errors) ? 'class="inputerror"' : '' ) . - ' value="'. $_POST['ShipperName'] .'" size=35 maxlength=40></td></tr> + <td><input type="text" name="ShipperName"'. (in_array('ShipperName',$Errors) ? 'class="inputerror"' : '' ) . + ' value="'. $_POST['ShipperName'] .'" size="35" maxlength="40" /></td> + </tr> </table> - <br /><div class="centre"><input type="Submit" name="submit" value="'. _('Enter Information').'"></div> + <br /> + <div class="centre"> + <input type="Submit" name="submit" value="'. _('Enter Information').'" /> + </div> </form>'; Modified: trunk/Shipt_Select.php =================================================================== --- trunk/Shipt_Select.php 2011-10-10 15:43:31 UTC (rev 4717) +++ trunk/Shipt_Select.php 2011-10-11 09:10:13 UTC (rev 4718) @@ -26,7 +26,7 @@ $SelectedSupplier=$_POST['SelectedSupplier']; } -echo '<form action="' . $_SERVER['PHP_SELF'] . '" method=post>'; +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; @@ -34,7 +34,7 @@ unset($SelectedStockItem); } -If (isset($ShiptRef) && $ShiptRef!="") { +If (isset($ShiptRef) AND $ShiptRef!='') { if (!is_numeric($ShiptRef)){ echo '<br />'; prnMsg( _('The Shipment Number entered MUST be numeric') ); @@ -45,11 +45,11 @@ } else { if (isset($SelectedSupplier)) { echo '<br />' ._('For supplier'). ': '. $SelectedSupplier . ' ' . _('and'). ' '; - echo '<input type=hidden name="SelectedSupplier" value="'. $SelectedSupplier. '">'; + echo '<input type="hidden" name="SelectedSupplier" value="'. $SelectedSupplier. '" />'; } If (isset($SelectedStockItem)) { echo _('for the part'). ': ' . $SelectedStockItem . '.'; - echo '<input type=hidden name="SelectedStockItem" value="'. $SelectedStockItem. '">'; + echo '<input type="hidden" name="SelectedStockItem" value="'. $SelectedStockItem. '" />'; } } @@ -61,6 +61,7 @@ } $SQL = "SELECT stockmaster.stockid, description, + decimalplaces, SUM(locstock.quantity) AS qoh, units, SUM(purchorderdetails.quantityord-purchorderdetails.quantityrecd) AS qord @@ -75,7 +76,7 @@ $SQL .= " WHERE purchorderdetails.shiptref IS NOT NULL AND purchorderdetails.shiptref<>0 - AND stockmaster.description " . LIKE . " '$SearchString' + AND stockmaster.description " . LIKE . " '" . $SearchString . "' AND categoryid='" . $_POST['StockCat'] . "'"; } elseif ($_POST['StockCode']){ @@ -92,49 +93,53 @@ } $SQL .= " GROUP BY stockmaster.stockid, - stockmaster.description, - stockmaster.units - ORDER BY stockmaster.stockid"; - + stockmaster.description, + stockmaster.decimalplaces, + stockmaster.units"; + $ErrMsg = _('No Stock Items were returned from the database because'). ' - '. DB_error_msg($db); $StockItemsResult = DB_query($SQL,$db, $ErrMsg); } if (!isset($ShiptRef) or $ShiptRef==""){ - echo '<table class=selection><tr><td>'; - echo _('Shipment Number'). ': <input type="text" name="ShiptRef" MAXLENGTH =10 size=10> '. + echo '<table class="selection"><tr><td>'; + echo _('Shipment Number'). ': <input type="text" name="ShiptRef" maxlength="10" size="10" /> '. _('Into Stock Location').' :<select name="StockLocation"> '; $sql = "SELECT loccode, locationname FROM locations"; $resultStkLocs = DB_query($sql,$db); while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation'])){ if ($myrow['loccode'] == $_POST['StockLocation']){ - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){ $_POST['StockLocation'] = $_SESSION['UserStockLocation']; - echo '<option selected Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } else { - echo '<option Value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select>'; echo ' <select name="OpenOrClosed">'; if ($_POST['OpenOrClosed']==1){ - echo '<option selected VALUE=1>'. _('Closed Shipments Only') . '</option>'; - echo '<option VALUE=0>'. _('Open Shipments Only') . '</option>'; + echo '<option selected value=1>'. _('Closed Shipments Only') . '</option>'; + echo '<option value=0>'. _('Open Shipments Only') . '</option>'; } else { $_POST['OpenOrClosed']=0; - echo '<option VALUE=1>'. _('Closed Shipments Only') . '</option>'; - echo '<option selected VALUE=0>'. _('Open Shipments Only') . '</option>'; + echo '<option value=1>'. _('Closed Shipments Only') . '</option>'; + echo '<option selected value=0>'. _('Open Shipments Only') . '</option>'; } echo '</select></td></tr></table>'; - echo '<br /><div class=centre><input type=submit name="SearchShipments" VALUE="'. _('Search Shipments'). '"></div></div><br />'; + echo '<br /> + <div class="centre"> + <input type="submit" name="SearchShipments" value="'. _('Search Shipments'). '" /> + </div> + <br />'; } $SQL="SELECT categoryid, @@ -144,13 +149,14 @@ ORDER BY categorydescription"; $result1 = DB_query($SQL,$db); -echo '<table class=selection>'; -echo '<tr><th colspan=5><font size=3 color=navy>'._('To search for shipments for a specific part use the part selection facilities below') . '</font></th></tr>'; -?> -<tr> -<td><font size=1><?php echo _('Select a stock category');?>:</font> -<select name="StockCat"> -<?php +echo '<table class="selection">'; +echo '<tr> + <th colspan="5"><font size="3" color="navy">'._('To search for shipments for a specific part use the part selection facilities below') . '</font></th> + </tr> + <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'] . '</option>'; @@ -158,31 +164,34 @@ echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } } -?> -</select> -<td><font size=1><?php echo _('Enter text extracts in the');?> <b><?php echo _('description');?></b>:</font></td> -<td><input type="Text" name="Keywords" size=20 maxlength=25></td></tr> -<tr><td></td> -<td><font SIZE 3><b><?php echo _('OR');?> </b></font><font size=1><?php echo _('Enter extract of the');?> <b><?php echo _('Stock Code');?></b>:</font></td> -<td><input type="Text" name="StockCode" size=15 maxlength=18></td> -</tr> -</table><br /> +echo '</select> + <td><font size="1">' . _('Enter text extracts in the') . '<b> ' . _('description') . '</b>:</font></td> + <td><input type="text" name="Keywords" size="20" maxlength="25" /></td> + </tr> + <tr> + <td></td> + <td><font size="3"><b>' . _('OR') . ' </b></font><font size="1"> ' . _('Enter extract of the') . ' <b> ' . _('Stock Code') . '</b>:</font></td> + <td><input type="text" name="StockCode" size="15" maxlength="18" /></td> + </tr> + </table> + <br />'; -<?php -echo '<div class=centre><input type=submit name="SearchParts" value="'._('Search Parts Now').'">'; -echo '<input type=submit name="ResetPart" value="'. _('Show All') .'"></div><br />'; +echo '<div class="centre"> + <input type="submit" name="SearchParts" value="'._('Search Parts Now').'" /> + <input type="submit" name="ResetPart" value="'. _('Show All') .'" /> + </div> + <br />'; if (isset($StockItemsResult)) { - echo '<table cellpadding=2 colspan=7 class="selection">'; + echo '<table class="selection">'; $TableHeader = '<tr> - <th>'. _('Code').'</th> - <th>'. _('Description').'</th> - <th>'. _('On Hand').'</th> - <th>'. _('Orders') . '<br />' . _('Outstanding').'</th> - <th>'. _('Units').'</th> - </tr>'; - + <th>'. _('Code').'</th> + <th>'. _('Description').'</th> + <th>'. _('On Hand').'</th> + <th>'. _('Orders') . '<br />' . _('Outstanding').'</th> + <th>'. _('Units').'</th> + </tr>'; echo $TableHeader; $j = 1; @@ -199,12 +208,16 @@ } /* Code Description On Hand Orders Ostdg Units Code Description On Hand Orders Ostdg Units */ - printf('<td><input type=submit name="SelectedStockItem" VALUE="%s" /></td> - <td>%s</td> - <td class=number>%s</td> - <td class=number>%s</td> - <td>%s</td></tr>', - $myrow['stockid'], $myrow['description'], $myrow['qoh'], $myrow['qord'],$myrow['units']); + printf('<td><input type="submit" name="SelectedStockItem" value="%s" /></td> + <td>%s</td> + <td class="number">%s</td> + <td class="number">%s</td> + <td>%s</td></tr>', + $myrow['stockid'], + $myrow['description'], + locale_number_format($myrow['qoh'],$myrow['decimalplaces']), + locale_number_format($myrow['qord'],$myrow['decimalplaces']), + $myrow['units']); $j++; If ($j == 15){ @@ -223,7 +236,7 @@ //figure out the SQL required from the inputs available - if (isset($ShiptRef) && $ShiptRef !="") { + if (isset($ShiptRef) AND $ShiptRef !="") { $SQL = "SELECT shipments.shiptref, vessel, voyageref, @@ -274,14 +287,14 @@ if (DB_num_rows($ShipmentsResult)>0){ /*show a table of the shipments returned by the SQL */ - echo '<table cellpadding=2 colspan=7 width=95% class=selection>'; + echo '<table width="95%" class="selection">'; $TableHeader = '<tr> - <th>'. _('Shipment'). '</th> - <th>'. _('Supplier'). '</th> - <th>'. _('Vessel'). '</th> - <th>'. _('Voyage'). '</th> - <th>'. _('Expected Arrival'). '</th> - </tr>'; + <th>'. _('Shipment'). '</th> + <th>'. _('Supplier'). '</th> + <th>'. _('Vessel'). '</th> + <th>'. _('Voyage'). '</th> + <th>'. _('Expected Arrival'). '</th> + </tr>'; echo $TableHeader; @@ -328,18 +341,18 @@ } else { printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href="%s">'._('Costing').'</a></td> - </tr>', - $myrow['shiptref'], - $myrow['suppname'], - $myrow['vessel'], - $myrow['voyage'], - $FormatedETA, - $URL_View_Shipment); + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> + <td><a href="%s">'._('Costing').'</a></td> + </tr>', + $myrow['shiptref'], + $myrow['suppname'], + $myrow['vessel'], + $myrow['voyage'], + $FormatedETA, + $URL_View_Shipment); } $j++; If ($j == 15){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |