From: <dai...@us...> - 2011-07-24 00:14:36
|
Revision: 4636 http://web-erp.svn.sourceforge.net/web-erp/?rev=4636&view=rev Author: daintree Date: 2011-07-24 00:14:27 +0000 (Sun, 24 Jul 2011) Log Message: ----------- Modified Paths: -------------- trunk/CustLoginSetup.php trunk/CustomerBranches.php trunk/OrderDetails.php trunk/OutstandingGRNs.php trunk/PDFCustTransListing.php trunk/PDFDIFOT.php trunk/PDFGrn.php trunk/PDFLowGP.php trunk/PDFOrderStatus.php trunk/PDFOrdersInvoiced.php trunk/PDFPeriodStockTransListing.php trunk/PageSecurity.php trunk/PaymentAllocations.php trunk/PaymentMethods.php trunk/PaymentTerms.php trunk/Payments.php trunk/SelectOrderItems.php trunk/SuppLoginSetup.php trunk/doc/Change.log trunk/doc/Manual/ManualPrices.html trunk/includes/DefinePaymentClass.php trunk/locale/de_DE.utf8/LC_MESSAGES/messages.po trunk/locale/hu_HU.utf8/LC_MESSAGES/messages.po trunk/locale/it_IT.utf8/LC_MESSAGES/messages.po trunk/locale/ja_JP.utf8/LC_MESSAGES/messages.po trunk/locale/pt_PT.utf8/LC_MESSAGES/messages.po Modified: trunk/CustLoginSetup.php =================================================================== --- trunk/CustLoginSetup.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/CustLoginSetup.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -22,11 +22,6 @@ '" alt="" />' . ' ' . _('Customer') . ' : ' . $_SESSION['CustomerID'] . ' - ' . $CustomerName. _(' has been selected') . '</p><br />'; -if (isset($_GET['SelectedUser'])){ - $SelectedUser = $_GET['SelectedUser']; -} elseif (isset($_POST['SelectedUser'])){ - $SelectedUser = $_POST['SelectedUser']; -} if (isset($_POST['submit'])) { @@ -48,7 +43,7 @@ $InputError = 1; prnMsg(_('The password entered must be at least 5 characters long'),'error'); } - } elseif (mb_strstr($_POST['Password'],$_POST['UserID'])!= False){ + } elseif (mb_strstr($_POST['Password'],$_POST['UserID'])!= false){ $InputError = 1; prnMsg(_('The password cannot contain the user id'),'error'); } elseif ((mb_strlen($_POST['Cust'])>0) AND (mb_strlen($_POST['BranchCode'])==0)) { @@ -60,7 +55,7 @@ // check that the entered branch is valid for the customer code $sql = "SELECT defaultlocation FROM custbranch - WHERE debtorno='" . $_POST['Cust'] . "' + WHERE debtorno='" . $_SESSION['CustomerID'] . "' AND branchcode='" . $_POST['BranchCode'] . "'"; $ErrMsg = _('The check on validity of the customer code and branch failed because'); @@ -75,47 +70,25 @@ $InventoryLocation = $myrow[0]; } - if (isset($SelectedUser) AND $InputError !=1) { + if ($InputError !=1) { - $UpdatePassword = ''; - if ($_POST['Password'] != ""){ - $UpdatePassword = "password='" . CryptPass($_POST['Password']) . "',"; - } - - $sql = "UPDATE www_users SET realname='" . $_POST['RealName'] . "', - phone='" . $_POST['Phone'] ."', - email='" . $_POST['Email'] ."', - ".$UpdatePassword." - branchcode='" . $_POST['BranchCode'] . "', - pagesize='" . $_POST['PageSize'] . "', - theme='" . $_POST['Theme'] . "', - language ='" . $_POST['UserLanguage'] . "', - defaultlocation='" . $InventoryLocation ."', - blocked='" . $_POST['Blocked'] . "' - WHERE userid = '".$SelectedUser."'"; - - prnMsg( _('The selected user record has been updated'), 'success' ); - - - } else { //no selected user so it's an insert of new user - - $sql = "INSERT INTO www_users (userid, - realname, - customerid, - branchcode, - password, - phone, - email, - pagesize, - fullaccess, - defaultlocation, - modulesallowed, - displayrecordsmax, - theme, - language) - VALUES ('" . $_POST['UserID'] . "', + $sql = "INSERT INTO www_users (userid, + realname, + customerid, + branchcode, + password, + phone, + email, + pagesize, + fullaccess, + defaultlocation, + modulesallowed, + displayrecordsmax, + theme, + language) + VALUES ('" . $_POST['UserID'] . "', '" . $_POST['RealName'] ."', - '" . $_POST['Cust'] ."', + '" . $_SESSION['CustomerID'] ."', '" . $_POST['BranchCode'] ."', '" . CryptPass($_POST['Password']) ."', '" . $_POST['Phone'] . "', @@ -127,166 +100,27 @@ '" . $_SESSION['DefaultDisplayRecordsMax'] . "', '" . $_POST['Theme'] . "', '". $_POST['UserLanguage'] ."')"; - prnMsg( _('A new user record has been inserted'), 'success' ); + + $ErrMsg = _('The user could not be added because'); + $DbgMsg = _('The SQL that was used to insert the new user and failed was'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); + prnMsg( _('A new customer login has been created'), 'success' ); + include('includes/footer.inc'); + exit; } } - if ($InputError!=1){ - //run the SQL from either of the above possibilites - $ErrMsg = _('The user alterations could not be processed because'); - $DbgMsg = _('The SQL that was used to update the user and failed was'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); - - unset($_POST['UserID']); - unset($_POST['RealName']); - unset($_POST['Cust']); - unset($_POST['BranchCode']); - unset($_POST['Phone']); - unset($_POST['Email']); - unset($_POST['Password']); - unset($_POST['PageSize']); - unset($_POST['Theme']); - unset($_POST['UserLanguage']); - unset($_POST['Blocked']); - unset($SelectedUser); - } - -} elseif (isset($_GET['delete'])) { -//the link to delete a selected record was clicked instead of the submit button - - $sql="SELECT userid FROM audittrail where userid='". $SelectedUser ."'"; - $result=DB_query($sql, $db); - if (DB_num_rows($result)!=0) { - prnMsg(_('Cannot delete user as entries already exist in the audit trail'), 'warn'); - } else { - - $sql="DELETE FROM www_users WHERE userid='".$SelectedUser."'"; - $ErrMsg = _('The User could not be deleted because');; - $result = DB_query($sql,$db,$ErrMsg); - prnMsg(_('User Deleted'),'info'); - } - unset($SelectedUser); } -if (!isset($SelectedUser)) { - -/* If its the first time the page has been displayed with no parameters then none of the above are true and the list of Users will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/ - - $sql = "SELECT userid, - realname, - phone, - email, - customerid, - branchcode, - lastvisitdate, - pagesize, - theme, - language - FROM www_users WHERE customerid = '" . $_SESSION['CustomerID'] . "'"; - $result = DB_query($sql,$db); - - echo '<table class="selection>"'; - - echo '<tr><th>' . _('User Login') . '</th> - <th>' . _('Full Name') . '</th> - <th>' . _('Telephone') . '</th> - <th>' . _('Email') . '</th> - <th>' . _('Last Visit') . '</th> - <th>' . _('Report Size') .'</th> - <th>' . _('Theme') .'</th> - <th>' . _('Language') .'</th> - </tr>'; - - $k=0; //row colour counter - - while ($myrow = DB_fetch_array($result)) { - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - - printf('<td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td><a href="%s&SelectedUser=%s">' . _('Edit') . '</a></td> - <td><a href="%s&SelectedUser=%s&delete=1" onclick="return confirm(\'' . _('Are you sure you wish to delete this user login?') . '\');">' . _('Delete') . '</a></td> - </tr>', - $myrow['userid'], - $myrow['realname'], - $myrow['phone'], - $myrow['email'], - $LastVisitDate, - $myrow['pagesize'], - $myrow['theme'], - $LanguagesArray[$myrow['language']], - $_SERVER['PHP_SELF'] . '?', - $myrow['userid'], - $_SERVER['PHP_SELF'] . '?', - $myrow['userid']); - - } //END WHILE LIST LOOP - echo '</table><br />'; -} //end of if there is no selected user - - -if (isset($SelectedUser)) { - echo '<div class="centre"><a href="' . $_SERVER['PHP_SELF'] .'">' . _('Review Existing Users') . '</a></div><br />'; -} echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; -if (isset($SelectedUser)) { - //editing an existing User +echo '<table class="selection"> + <tr> + <td>' . _('User Login') . ':</td> + <td><input type="text" name="UserID" size="22" maxlength="20" /></td> + </tr>'; - $sql = "SELECT userid, - realname, - phone, - email, - customerid, - password, - branchcode, - pagesize, - theme, - language - FROM www_users - WHERE userid='" . $SelectedUser . "'"; - - $result = DB_query($sql, $db); - $myrow = DB_fetch_array($result); - - $_POST['UserID'] = $myrow['userid']; - $_POST['RealName'] = $myrow['realname']; - $_POST['Phone'] = $myrow['phone']; - $_POST['Email'] = $myrow['email']; - $_POST['PageSize'] = $myrow['pagesize']; - $_POST['Theme'] = $myrow['theme']; - $_POST['UserLanguage'] = $myrow['language']; - - echo '<input type="hidden" name="SelectedUser" value="' . $SelectedUser . '">'; - echo '<input type="hidden" name="UserID" value="' . $_POST['UserID'] . '">'; - - echo '<table class="selection"> - <tr> - <td>' . _('User code') . ':</td> - <td>' . $_POST['UserID'] . '</td> - </tr>'; - -} else { //end of if $SelectedUser only do the else when a new record is being entered - echo '<table class="selection"> - <tr> - <td>' . _('User Login') . ':</td> - <td><input type="text" name="UserID" size="22" maxlength="20" /></td> - </tr>'; -} - if (!isset($_POST['Password'])) { $_POST['Password']=''; } @@ -312,15 +146,11 @@ //Customer is fixed by selection of customer -$_POST['Cust']=$_SESSION['CustomerID']; -echo '<input type="hidden" name="Cust" value="' . $_POST['Cust'] . '">'; -echo '<tr><td>'._('Customer Code').':</td> - <td>' . $_POST['Cust'] . '</td></tr>'; echo '<tr><td>' . _('Branch Code') . ':</td> <td><select name="BranchCode">'; -$sql = "SELECT branchcode FROM custbranch WHERE debtorno = '" . $_POST['Cust'] . "'"; +$sql = "SELECT branchcode FROM custbranch WHERE debtorno = '" . $_SESSION['CustomerID'] . "'"; $result = DB_query($sql,$db); while ($myrow=DB_fetch_array($result)){ @@ -420,20 +250,8 @@ echo '<option value="' . $LanguageEntry . '">' . $LanguageName .'</option>'; } } - - echo '</select></td></tr>'; -echo '<tr><td>' . _('Account Status') . ':</td> - <td><select name="Blocked">'; -if ($_POST['Blocked']==0){ - echo '<option selected value="0">' . _('Open') . '</option> - <option value="1">' . _('Blocked') . '</option>'; -} else { - echo '<option value="0">' . _('Open') . '</option> - <option selected value="1">' . _('Blocked') . '</option>'; -} -echo '</select></td></tr>'; echo '</table><br /> <div class="centre"><input type="submit" name="submit" value="' . _('Enter Information') . '"></div> Modified: trunk/CustomerBranches.php =================================================================== --- trunk/CustomerBranches.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/CustomerBranches.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -431,14 +431,14 @@ echo '<b>'.($TotalEnable+$TotalDisable). '</b> ' . _('Total Branches') . '</div></td></tr></table>'; } else { $sql = "SELECT debtorsmaster.name, - address1, - address2, - address3, - address4, - address5, - address6 - FROM debtorsmaster - WHERE debtorno = '".$DebtorNo."'"; + address1, + address2, + address3, + address4, + address5, + address6 + FROM debtorsmaster + WHERE debtorno = '".$DebtorNo."'"; $result = DB_query($sql,$db); $myrow = DB_fetch_row($result); @@ -463,35 +463,35 @@ //editing an existing branch $sql = "SELECT branchcode, - brname, - braddress1, - braddress2, - braddress3, - braddress4, - braddress5, - braddress6, - specialinstructions, - estdeliverydays, - fwddate, - salesman, - area, - phoneno, - faxno, - contactname, - email, - taxgroupid, - defaultlocation, - brpostaddr1, - brpostaddr2, - brpostaddr3, - brpostaddr4, - disabletrans, - defaultshipvia, - custbranchcode, - deliverblind - FROM custbranch - WHERE branchcode='".$SelectedBranch."' - AND debtorno='".$DebtorNo."'"; + brname, + braddress1, + braddress2, + braddress3, + braddress4, + braddress5, + braddress6, + specialinstructions, + estdeliverydays, + fwddate, + salesman, + area, + phoneno, + faxno, + contactname, + email, + taxgroupid, + defaultlocation, + brpostaddr1, + brpostaddr2, + brpostaddr3, + brpostaddr4, + disabletrans, + defaultshipvia, + custbranchcode, + deliverblind + FROM custbranch + WHERE branchcode='".$SelectedBranch."' + AND debtorno='".$DebtorNo."'"; $result = DB_query($sql, $db); $myrow = DB_fetch_array($result); @@ -547,12 +547,12 @@ */ if (isset($_GET['BranchCode'])){ $sql="SELECT name, - address1, - address2, - address3, - address4, - address5, - address6 + address1, + address2, + address3, + address4, + address5, + address6 FROM debtorsmaster WHERE debtorno='".$_GET['BranchCode']."'"; @@ -579,22 +579,7 @@ $_POST['DeliverBlind'] = $_SESSION['DefaultBlindPackNote']; } - //SQL to poulate account selection boxes - $sql = "SELECT salesmanname, - salesmancode - FROM salesman - WHERE current = 1"; - $result = DB_query($sql,$db); - - if (DB_num_rows($result)==0){ - echo '</table>'; - prnMsg(_('There are no sales people defined as yet') . ' - ' . _('customer branches must be allocated to a sales person') . '. ' . _('Please use the link below to define at least one sales person'),'error'); - echo '<p align="center"><a href="' . $rootpath . '/SalesPeople.php">'._('Define Sales People') . '</a>'; - include('includes/footer.inc'); - exit; - } - echo '<input type=hidden name="DebtorNo" value="'. $DebtorNo . '" />'; @@ -636,6 +621,23 @@ if (!isset($_POST['FwdDate'])) {$_POST['FwdDate']=0;} echo '<td><input ' .(in_array('FwdDate',$Errors) ? 'class="inputerror"' : '' ) .' tabindex=12 type="text" class=number name="FwdDate" size=4 maxlength=2 value='. $_POST['FwdDate'].'></td></tr>'; + + //SQL to poulate account selection boxes + $sql = "SELECT salesmanname, + salesmancode + FROM salesman + WHERE current = 1"; + + $result = DB_query($sql,$db); + + if (DB_num_rows($result)==0){ + echo '</table>'; + prnMsg(_('There are no sales people defined as yet') . ' - ' . _('customer branches must be allocated to a sales person') . '. ' . _('Please use the link below to define at least one sales person'),'error'); + echo '<p align="center"><a href="' . $rootpath . '/SalesPeople.php">'._('Define Sales People') . '</a>'; + include('includes/footer.inc'); + exit; + } + echo '<tr><td>'._('Salesperson').':</td>'; echo '<td><select tabindex=13 name="Salesman">'; @@ -717,15 +719,22 @@ //only display email link if there is an email address echo '<td><input tabindex=18 type="text" name="Email" size=56 maxlength=55 value="'. $_POST['Email'].'"></td></tr>'; - echo '<tr><td>'._('Tax Group').':</td>'; - echo '<td><select tabindex=19 name="TaxGroup">'; DB_data_seek($result,0); $sql = "SELECT taxgroupid, taxgroupdescription FROM taxgroups"; - $result = DB_query($sql,$db); - - while ($myrow = DB_fetch_array($result)) { + $TaxGroupResults = DB_query($sql,$db); + if (DB_num_rows($TaxGroupResults)==0){ + echo '</table>'; + prnMsg(_('There are no tax groups defined - these must be set up first before any branches can be set up') . ' + <br /><a href="' . $rootpath . '/TaxGroups.php">' . _('Define Tax Groups') . '</a>','error'); + include('includes/footer.inc'); + exit; + } + echo '<tr><td>'._('Tax Group').':</td> + <td><select tabindex=19 name="TaxGroup">'; + + while ($myrow = DB_fetch_array($TaxGroupResults)) { if (isset($_POST['TaxGroup']) and $myrow['taxgroupid']==$_POST['TaxGroup']) { echo '<option selected value="'; } else { @@ -748,10 +757,18 @@ echo ' </select></td></tr>'; + + $SQL = "SELECT shipper_id, shippername FROM shippers"; + $ShipperResults = DB_query($SQL,$db); + if (DB_num_rows($ShipperResults)==0){ + echo '</table>'; + prnMsg(_('There are no shippers defined - these must be set up first before any branches can be set up') . ' + <br /><a href="' . $rootpath . '/Shippers.php">' . _('Define Shippers') . '</a>','error'); + include('includes/footer.inc'); + exit; + } echo '<tr><td>'._('Default freight/shipper method') . ':</td> <td><select tabindex=21 name="DefaultShipVia">'; - $SQL = "SELECT shipper_id, shippername FROM shippers"; - $ShipperResults = DB_query($SQL,$db); while ($myrow=DB_fetch_array($ShipperResults)){ if (isset($_POST['DefaultShipVia'])and $myrow['shipper_id']==$_POST['DefaultShipVia']){ echo '<option selected value=' . $myrow['shipper_id'] . '>' . $myrow['shippername'] . '</option>'; Modified: trunk/OrderDetails.php =================================================================== --- trunk/OrderDetails.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/OrderDetails.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -1,9 +1,7 @@ <?php -/* $Revision: 1.25 $ */ + /* $Id$*/ -//$PageSecurity = 2; - /* Session started in header.inc for password checking and authorisation level check */ include('includes/session.inc'); @@ -21,34 +19,33 @@ include('includes/header.inc'); -$OrderHeaderSQL = "SELECT - salesorders.debtorno, - debtorsmaster.name, - salesorders.branchcode, - salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.ordertype, - salesorders.shipvia, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.contactphone, - salesorders.contactemail, - salesorders.freightcost, - salesorders.deliverydate, - debtorsmaster.currcode, - salesorders.fromstkloc - FROM - salesorders, - debtorsmaster - WHERE - salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.orderno = '" . $_GET['OrderNumber'] . "'"; +$OrderHeaderSQL = "SELECT salesorders.debtorno, + debtorsmaster.name, + salesorders.branchcode, + salesorders.customerref, + salesorders.comments, + salesorders.orddate, + salesorders.ordertype, + salesorders.shipvia, + salesorders.deliverto, + salesorders.deladd1, + salesorders.deladd2, + salesorders.deladd3, + salesorders.deladd4, + salesorders.deladd5, + salesorders.deladd6, + salesorders.contactphone, + salesorders.contactemail, + salesorders.freightcost, + salesorders.deliverydate, + debtorsmaster.currcode, + salesorders.fromstkloc, + currencies.decimalplaces + FROM salesorders INNER JOIN debtorsmaster + ON salesorders.debtorno = debtorsmaster.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev + WHERE salesorders.orderno = '" . $_GET['OrderNumber'] . "'"; $ErrMsg = _('The order cannot be retrieved because'); $DbgMsg = _('The SQL that failed to get the order header was'); @@ -59,7 +56,9 @@ _('Order Details') . '" alt="" />' . ' ' . $title . '</p>'; $myrow = DB_fetch_array($GetOrdHdrResult); - echo '<table class=selection>'; + $CurrDecimalPlaces = $myrow['decimalplaces']; + + echo '<table class="selection">'; echo '<tr><th colspan=4><font color=blue>'._('Order Header Details For Order No').' '.$_GET['OrderNumber'].'</font></th></tr>'; echo '<tr> <th style="text-align: left">' . _('Customer Code') . ':</th> @@ -118,24 +117,24 @@ /*Now get the line items */ - $LineItemsSQL = "SELECT - stkcode, - stockmaster.description, - stockmaster.volume, - stockmaster.kgs, - stockmaster.decimalplaces, - stockmaster.mbflag, - stockmaster.units, - stockmaster.discountcategory, - stockmaster.controlled, - stockmaster.serialised, - unitprice, - quantity, - discountpercent, - actualdispatchdate, - qtyinvoiced - FROM salesorderdetails, stockmaster - WHERE salesorderdetails.stkcode = stockmaster.stockid AND orderno ='" . $_GET['OrderNumber'] . "'"; + $LineItemsSQL = "SELECT stkcode, + stockmaster.description, + stockmaster.volume, + stockmaster.kgs, + stockmaster.decimalplaces, + stockmaster.mbflag, + stockmaster.units, + stockmaster.discountcategory, + stockmaster.controlled, + stockmaster.serialised, + unitprice, + quantity, + discountpercent, + actualdispatchdate, + qtyinvoiced + FROM salesorderdetails INNER JOIN stockmaster + ON salesorderdetails.stkcode = stockmaster.stockid + WHERE orderno ='" . $_GET['OrderNumber'] . "'"; $ErrMsg = _('The line items of the order cannot be retrieved because'); $DbgMsg = _('The SQL used to retrieve the line items, that failed was'); @@ -150,15 +149,15 @@ echo '<br /><table cellpadding=2 colspan=9 class=selection>'; echo '<tr><th colspan=9><font color=blue>'._('Order Line Details For Order No').' '.$_GET['OrderNumber'].'</font></th></tr>'; echo '<tr> - <th>' . _('Item Code') . '</th> - <th>' . _('Item Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Unit') . '</th> - <th>' . _('Price') . '</th> - <th>' . _('Discount') . '</th> - <th>' . _('Total') . '</th> - <th>' . _('Qty Del') . '</th> - <th>' . _('Last Del') . '</th> + <th>' . _('Item Code') . '</th> + <th>' . _('Item Description') . '</th> + <th>' . _('Quantity') . '</th> + <th>' . _('Unit') . '</th> + <th>' . _('Price') . '</th> + <th>' . _('Discount') . '</th> + <th>' . _('Total') . '</th> + <th>' . _('Qty Del') . '</th> + <th>' . _('Last Del') . '</th> </tr>'; $k=0; while ($myrow=db_fetch_array($LineItemsResult)) { @@ -181,10 +180,10 @@ <td>' . $myrow['description'] . '</td> <td class=number>' . $myrow['quantity'] . '</td> <td>' . $myrow['units'] . '</td> - <td class=number>' . number_format($myrow['unitprice'],2) . '</td> + <td class=number>' . number_format($myrow['unitprice'],$CurrDecimalPlaces) . '</td> <td class=number>' . number_format(($myrow['discountpercent'] * 100),2) . '%' . '</td> - <td class=number>' . number_format($myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent']),2) . '</td> - <td class=number>' . number_format($myrow['qtyinvoiced'],2) . '</td> + <td class=number>' . number_format($myrow['quantity'] * $myrow['unitprice'] * (1 - $myrow['discountpercent']),$CurrDecimalPlaces) . '</td> + <td class=number>' . number_format($myrow['qtyinvoiced'],$myrow['decimalplaces']) . '</td> <td>' . $DisplayActualDeliveryDate . '</td> </tr>'; @@ -193,7 +192,7 @@ $OrderTotalWeight = $OrderTotalWeight + $myrow['quantity'] * $myrow['kgs']; } - $DisplayTotal = number_format($OrderTotal,2); + $DisplayTotal = number_format($OrderTotal,$CurrDecimalPlaces); $DisplayVolume = number_format($OrderTotalVolume,2); $DisplayWeight = number_format($OrderTotalWeight,2); Modified: trunk/OutstandingGRNs.php =================================================================== --- trunk/OutstandingGRNs.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/OutstandingGRNs.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -30,13 +30,18 @@ quantityinv, grns.stdcostunit, actprice, - unitprice - FROM grns, - purchorderdetails, - suppliers - WHERE grns.supplierid=suppliers.supplierid - AND grns.podetailitem = purchorderdetails.podetailitem - AND qtyrecd-quantityinv>0 + unitprice, + currencies.decimalplaces as currdecimalplaces, + stockmaster.decimalplaces as itemdecimalplaces + FROM grns INNER JOIN purchorderdetails + ON grns.podetailitem = purchorderdetails.podetailitem + INNER JOIN suppliers + ON grns.supplierid=suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + LEFT JOIN stockmaster + ON grns.itemcode=stockmaster.stockid + WHERE qtyrecd-quantityinv>0 AND grns.supplierid >='" . $_POST['FromCriteria'] . "' AND grns.supplierid <='" . $_POST['ToCriteria'] . "' ORDER BY supplierid, @@ -81,7 +86,7 @@ /* need to print the total of previous supplier */ $YPos -= (2*$line_height); $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,260-$Left_Margin,$FontSize,_('Total for') . ' ' . $Supplier . ' - ' . $SupplierName); - $DisplaySuppTotVal = number_format($SuppTot_Val,2); + $DisplaySuppTotVal = number_format($SuppTot_Val,$GRNs['decimalplaces']); $LeftOvers = $pdf->addTextWrap(500,$YPos,60,$FontSize,$DisplaySuppTotVal, 'right'); $YPos -=$line_height; $pdf->line($Left_Margin, $YPos+$line_height-2,$Page_Width-$Right_Margin, $YPos+$line_height-2); @@ -93,16 +98,21 @@ $SupplierName = $GRNs['suppname']; } $YPos -=$line_height; - + + if ($GRNs['itemdecimalplaces']==null){ + $ItemDecimalPlaces = 2; + } else { + $ItemDecimalPlaces = $GRNs['itemdecimalplaces']; + } $LeftOvers = $pdf->addTextWrap(32,$YPos,40,$FontSize,$GRNs['grnno']); $LeftOvers = $pdf->addTextWrap(70,$YPos,40,$FontSize,$GRNs['orderno']); $LeftOvers = $pdf->addTextWrap(110,$YPos,200,$FontSize,$GRNs['itemcode'] . ' - ' . $GRNs['itemdescription']); - $DisplayStdCost = number_format($GRNs['stdcostunit'],2); - $DisplayQtyRecd = number_format($GRNs['qtyrecd'],2); - $DisplayQtyInv = number_format($GRNs['quantityinv'],2); - $DisplayQtyOstg = number_format($GRNs['qtyrecd']- $GRNs['quantityinv'],2); + $DisplayStdCost = number_format($GRNs['stdcostunit'],$_SESSION['CompanyRecord']['decimalplaces']); + $DisplayQtyRecd = number_format($GRNs['qtyrecd'],$ItemDecimalPlaces); + $DisplayQtyInv = number_format($GRNs['quantityinv'],$ItemDecimalPlaces); + $DisplayQtyOstg = number_format($GRNs['qtyrecd']- $GRNs['quantityinv'],$ItemDecimalPlaces); $LineValue = ($GRNs['qtyrecd']- $GRNs['quantityinv'])*$GRNs['stdcostunit']; - $DisplayValue = number_format($LineValue,2); + $DisplayValue = number_format($LineValue,$_SESSION['CompanyRecord']['decimalplaces']); $LeftOvers = $pdf->addTextWrap(310,$YPos,50,$FontSize,$DisplayQtyRecd,'right'); $LeftOvers = $pdf->addTextWrap(360,$YPos,50,$FontSize,$DisplayQtyInv, 'right'); Modified: trunk/PDFCustTransListing.php =================================================================== --- trunk/PDFCustTransListing.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/PDFCustTransListing.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -54,15 +54,20 @@ } $sql= "SELECT type, - debtorno, - transno, - trandate, - ovamount, - ovgst, - invtext - FROM debtortrans - WHERE type='" . $_POST['TransType'] . "' - AND date_format(inputdate, '%Y-%m-%d')='".FormatDateForSQL($_POST['Date'])."'"; + debtortrans.debtorno, + transno, + trandate, + ovamount, + ovgst, + invtext, + debtortrans.rate, + decimalplaces + FROM debtortrans INNER JOIN debtorsmaster + ON debtortrans.debtorno=debtorsmaster.debtorno + INNER JOIN currencies + ON debtorsmaster.currcode=currencies.currabrev + WHERE type='" . $_POST['TransType'] . "' + AND date_format(inputdate, '%Y-%m-%d')='".FormatDateForSQL($_POST['Date'])."'"; $result=DB_query($sql,$db,'','',false,false); @@ -70,8 +75,8 @@ $title = _('Payment Listing'); include('includes/header.inc'); prnMsg(_('An error occurred getting the transactions'),'error'); - if ($Debug==1){ - prnMsg(_('The SQL used to get the transaction information that failed was') . ':<br />' . $SQL,'error'); + if ($debug==1){ + prnMsg(_('The SQL used to get the transaction information that failed was') . ':<br />' . $sql,'error'); } include('includes/footer.inc'); exit; @@ -92,7 +97,7 @@ $pdf->addInfo('Subject',_('Customer transaction listing from') . ' ' . $_POST['Date'] ); $line_height=12; $PageNumber = 1; -$TotalCheques = 0; +$TotalAmount = 0; include ('includes/PDFCustTransListingPageHeader.inc'); @@ -105,12 +110,12 @@ $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,160,$FontSize,$supplierrow['name'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+162,$YPos,80,$FontSize,$myrow['transno'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+242,$YPos,70,$FontSize,ConvertSQLDate($myrow['trandate']), 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,number_format($myrow['ovamount'],2), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,number_format($myrow['ovgst'],2), 'right'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,number_format($myrow['ovamount']+$myrow['ovgst'],2), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+312,$YPos,70,$FontSize,number_format($myrow['ovamount'],$myrow['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+382,$YPos,70,$FontSize,number_format($myrow['ovgst'],$myrow['decimalplaces']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,number_format($myrow['ovamount']+$myrow['ovgst'],$myrow['decimalplaces']), 'right'); $YPos -= ($line_height); - $TotalCheques = $TotalCheques - $myrow['ovamount']; + $TotalAmount = $TotalAmount + ($myrow['ovamount']/$myrow['rate']); if ($YPos - (2 *$line_height) < $Bottom_Margin){ /*Then set up a new page */ @@ -121,8 +126,8 @@ $YPos-=$line_height; -$LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,number_format(-$TotalCheques,2), 'right'); -$LeftOvers = $pdf->addTextWrap($Left_Margin+265,$YPos,300,$FontSize,_('Total') . ' ' . _('Transactions'), 'left'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+452,$YPos,70,$FontSize,number_format($TotalAmount,$_SESSION['CompanyRecord']['decimalplaces']), 'right'); +$LeftOvers = $pdf->addTextWrap($Left_Margin+265,$YPos,300,$FontSize,_('Total') . ' ' . _('Transactions') . ' ' . $_SESSION['CompanyRecord']['CurrencyDefault'], 'left'); $ReportFileName = $_SESSION['DatabaseName'] . '_CustTransListing_' . date('Y-m-d').'.pdf'; $pdf->OutputD($ReportFileName); Modified: trunk/PDFDIFOT.php =================================================================== --- trunk/PDFDIFOT.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/PDFDIFOT.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -26,7 +26,7 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection> + echo '<table class="selection"> <tr> <td>' . _('Enter the date from which variances between orders and deliveries are to be listed') . ':</td> <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="FromDate" maxlength=10 size=10 value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-1,0,Date('y'))) . '"></td> @@ -41,9 +41,9 @@ } echo '<tr> - <td>' . _('Enter the number of days considered acceptable between delivery requested date and invoice date(ie the date dispatched)') . ':</td> - <td><input type="text" class="number" name="DaysAcceptable" maxlength=2 size=2 value="' . $_POST['DaysAcceptable'] . '"></td> - </tr>'; + <td>' . _('Enter the number of days considered acceptable between delivery requested date and invoice date(ie the date dispatched)') . ':</td> + <td><input type="text" class="number" name="DaysAcceptable" maxlength=2 size=2 value="' . $_POST['DaysAcceptable'] . '"></td> + </tr>'; echo '<tr><td>' . _('Inventory Category') . '</td><td>'; $sql = "SELECT categorydescription, categoryid FROM stockcategory WHERE stocktype<>'D' AND stocktype<>'L'"; @@ -57,7 +57,6 @@ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>'; } - echo '</select></td></tr>'; echo '<tr><td>' . _('Inventory Location') . ':</td> @@ -99,6 +98,7 @@ salesorderdetails.quantity, salesorderdetails.stkcode, stockmaster.description, + stockmaster.decimalplaces, salesorders.debtorno, salesorders.branchcode FROM salesorderdetails INNER JOIN stockmaster @@ -116,6 +116,7 @@ salesorderdetails.quantity, salesorderdetails.stkcode, stockmaster.description, + stockmaster.decimalplaces, salesorders.debtorno, salesorders.branchcode FROM salesorderdetails INNER JOIN stockmaster @@ -136,6 +137,7 @@ salesorderdetails.quantity, salesorderdetails.stkcode, stockmaster.description, + stockmaster.decimalplaces, salesorders.debtorno, salesorders.branchcode FROM salesorderdetails INNER JOIN stockmaster @@ -156,6 +158,7 @@ salesorderdetails.quantity, salesorderdetails.stkcode, stockmaster.description, + stockmaster.decimalplaces, salesorders.debtorno, salesorders.branchcode FROM salesorderdetails INNER JOIN stockmaster @@ -214,7 +217,7 @@ if ($DaysDiff > $_POST['DaysAcceptable']){ $LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,40,$FontSize,$myrow['orderno'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+40,$YPos,200,$FontSize,$myrow['stkcode'] .' - ' . $myrow['description'], 'left'); - $LeftOvers = $pdf->addTextWrap($Left_Margin+240,$YPos,50,$FontSize,number_format($myrow['quantity']), 'right'); + $LeftOvers = $pdf->addTextWrap($Left_Margin+240,$YPos,50,$FontSize,number_format($myrow['quantity'],$myrow['decimalplaces']), 'right'); $LeftOvers = $pdf->addTextWrap($Left_Margin+295,$YPos,50,$FontSize,$myrow['debtorno'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+345,$YPos,50,$FontSize,$myrow['branchcode'], 'left'); $LeftOvers = $pdf->addTextWrap($Left_Margin+395,$YPos,50,$FontSize,ConvertSQLDate($myrow['actualdispatchdate']), 'left'); @@ -286,14 +289,14 @@ $ReportFileName = $_SESSION['DatabaseName'] . '_DIFOT_' . date('Y-m-d').'.pdf'; -$pdf->OutputD($ReportFileName);//UldisN -$pdf->__destruct(); //UldisN +$pdf->OutputD($ReportFileName); +$pdf->__destruct(); if ($_POST['Email']=='Yes'){ if (file_exists($_SESSION['reports_dir'] . '/'.$ReportFileName)){ unlink($_SESSION['reports_dir'] . '/'.$ReportFileName); } - $fp = fopen( $_SESSION['reports_dir'] . '/'.$ReportFileName,'wb'); + $fp = fopen( $_SESSION['reports_dir'] . '/'.$ReportFileName,'wb'); fwrite ($fp, $pdfcode); fclose ($fp); Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/PDFGrn.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -41,35 +41,35 @@ } else { //NOT PREVIEW $sql="SELECT grns.itemcode, - grns.grnno, - grns.deliverydate, - grns.itemdescription, - grns.qtyrecd, - grns.supplierid, - purchorderdetails.suppliersunit, - purchorderdetails.conversionfactor, - stockmaster.units, - stockmaster.decimalplaces - FROM grns INNER JOIN purchorderdetails - ON grns.podetailitem=purchorderdetails.podetailitem - LEFT JOIN stockmaster - ON grns.itemcode=stockmaster.stockid - WHERE grnbatch='".$GRNNo."'"; + grns.grnno, + grns.deliverydate, + grns.itemdescription, + grns.qtyrecd, + grns.supplierid, + purchorderdetails.suppliersunit, + purchorderdetails.conversionfactor, + stockmaster.units, + stockmaster.decimalplaces + FROM grns INNER JOIN purchorderdetails + ON grns.podetailitem=purchorderdetails.podetailitem + LEFT JOIN stockmaster + ON grns.itemcode=stockmaster.stockid + WHERE grnbatch='".$GRNNo."'"; $GRNResult=DB_query($sql, $db); $NoOfGRNs = DB_num_rows($GRNResult); if($NoOfGRNs>0) { //there are GRNs to print $sql = "SELECT suppliers.suppname, - suppliers.address1, - suppliers.address2 , - suppliers.address3, - suppliers.address4, - suppliers.address5, - suppliers.address6 - FROM grns INNER JOIN suppliers - ON grns.supplierid=suppliers.supplierid - WHERE grnbatch='".$GRNNo."'"; + suppliers.address1, + suppliers.address2 , + suppliers.address3, + suppliers.address4, + suppliers.address5, + suppliers.address6 + FROM grns INNER JOIN suppliers + ON grns.supplierid=suppliers.supplierid + WHERE grnbatch='".$GRNNo."'"; $SuppResult = DB_query($sql,$db,_('Could not get the supplier of the selected GRN')); $SuppRow = DB_fetch_array($SuppResult); } Modified: trunk/PDFLowGP.php =================================================================== --- trunk/PDFLowGP.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/PDFLowGP.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -28,27 +28,26 @@ /*Now figure out the data to report for the category range under review */ $SQL = "SELECT stockmaster.categoryid, - stockmaster.stockid, - stockmoves.transno, - stockmoves.trandate, - systypes.typename, - stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost as unitcost, - stockmoves.qty, - stockmoves.debtorno, - stockmoves.branchcode, - stockmoves.price*(1-stockmoves.discountpercent) as sellingprice, - (stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) AS gp, - debtorsmaster.name - FROM stockmaster, - stockmoves, - systypes, - debtorsmaster - WHERE stockmoves.type=systypes.typeid - AND stockmaster.stockid=stockmoves.stockid - AND stockmoves.trandate >= '" . FormatDateForSQL($_POST['FromDate']) . "' + stockmaster.stockid, + stockmoves.transno, + stockmoves.trandate, + systypes.typename, + stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost as unitcost, + stockmoves.qty, + stockmoves.debtorno, + stockmoves.branchcode, + stockmoves.price*(1-stockmoves.discountpercent) as sellingprice, + (stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) AS gp, + debtorsmaster.name + FROM stockmaster INNER JOIN stockmoves + ON stockmaster.stockid=stockmoves.stockid + INNER JOIN systypes + ON stockmoves.type=systypes.typeid + INNER JOIN debtorsmaster + ON stockmoves.debtorno=debtorsmaster.debtorno + WHERE stockmoves.trandate >= '" . FormatDateForSQL($_POST['FromDate']) . "' AND stockmoves.trandate <= '" . FormatDateForSQL($_POST['ToDate']) . "' AND ((stockmoves.price*(1-stockmoves.discountpercent)) - (stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost))/(stockmoves.price*(1-stockmoves.discountpercent)) <=" . ($_POST['GPMin']/100) . " - AND stockmoves.debtorno=debtorsmaster.debtorno ORDER BY stockmaster.stockid"; $LowGPSalesResult = DB_query($SQL,$db,'','',false,false); @@ -90,9 +89,9 @@ $LeftOvers = $pdf->addTextWrap(100,$YPos,30,$FontSize,$LowGPItems['transno']); $LeftOvers = $pdf->addTextWrap(130,$YPos,50,$FontSize,$LowGPItems['stockid']); $LeftOvers = $pdf->addTextWrap(220,$YPos,50,$FontSize,$LowGPItems['name']); - $DisplayUnitCost = number_format($LowGPItems['unitcost'],2); - $DisplaySellingPrice = number_format($LowGPItems['sellingprice'],2); - $DisplayGP = number_format($LowGPItems['gp'],2); + $DisplayUnitCost = number_format($LowGPItems['unitcost'],$_SESSION['CompanyRecord']['decimalplaces']); + $DisplaySellingPrice = number_format($LowGPItems['sellingprice'],$_SESSION['CompanyRecord']['decimalplaces']); + $DisplayGP = number_format($LowGPItems['gp'],$_SESSION['CompanyRecord']['decimalplaces']); $DisplayGPPercent = number_format(($LowGPItems['gp']*100)/$LowGPItems['sellingprice'],1); $LeftOvers = $pdf->addTextWrap(330,$YPos,60,$FontSize,$DisplaySellingPrice,'right'); @@ -138,11 +137,14 @@ </tr>'; echo '<tr><td>' . _('Show sales with GP') . '%' . _('below') . ':</td> - <td><input type="text" class="number" name="GPMin" maxlength="3" size="3" value="' . $_POST['GPMin'] . '"></td> - </tr>'; + <td><input type="text" class="number" name="GPMin" maxlength="3" size="3" value="' . $_POST['GPMin'] . '"></td> + </tr>'; echo '</table> - <br /><div class="centre"><input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"></div>'; + <br /> + <div class="centre"> + <input type="submit" name="PrintPDF" value="' . _('Print PDF') . '"> + </div>'; } include('includes/footer.inc'); Modified: trunk/PDFOrderStatus.php =================================================================== --- trunk/PDFOrderStatus.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/PDFOrderStatus.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -61,13 +61,17 @@ } echo '</select></td></tr>'; - echo '<tr><td>' . _('Back Order Only') . ':</td><td><select name="BackOrders">'; - echo '<option selected value="Yes">' . _('Only Show Back Orders') . '</option>'; - echo '<option value="No">' . _('Show All Orders') . '</option>'; - echo '</select></td> - </tr> - </table> - <br /><div class="centre"><input type=submit name="Go" value="' . _('Create PDF') . '"></div>'; + echo '<tr><td>' . _('Back Order Only') . ':</td> + <td><select name="BackOrders"> + <option selected value="Yes">' . _('Only Show Back Orders') . '</option> + <option value="No">' . _('Show All Orders') . '</option> + </select></td> + </tr> + </table> + <br /> + <div class="centre"> + <input type=submit name="Go" value="' . _('Create PDF') . '"> + </div>'; include('includes/footer.inc'); exit; @@ -228,7 +232,6 @@ AND salesorders.orddate >='" . FormatDateForSQL($_POST['FromDate']) . "' AND salesorders.orddate <='" . FormatDateForSQL($_POST['ToDate']) . "' AND salesorders.quotation=0"; - } if ($_POST['BackOrders']=='Yes'){ Modified: trunk/PDFOrdersInvoiced.php =================================================================== --- trunk/PDFOrdersInvoiced.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/PDFOrdersInvoiced.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -35,7 +35,11 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection><tr><td>' . _('Enter the date from which orders are to be listed') . ':</td><td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="FromDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))) . '"></td></tr>'; + echo '<table class="selection"> + <tr> + <td>' . _('Enter the date from which orders are to be listed') . ':</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="FromDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m'),Date('d')-1,Date('y'))) . '"></td> + </tr>'; echo '<tr><td>' . _('Enter the date to which orders are to be listed') . ':</td> <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="10" value="' . Date($_SESSION['DefaultDateFormat']) . '"></td></tr>'; echo '<tr><td>' . _('Inventory Category') . '</td><td>'; @@ -55,7 +59,7 @@ echo '<tr><td>' . _('Inventory Location') . ':</td><td><select name="Location">'; echo '<option selected value="All">' . _('All Locations') . '</option>'; - $result= DB_query('SELECT loccode, locationname FROM locations',$db); + $result= DB_query("SELECT loccode, locationname FROM locations",$db); while ($myrow=DB_fetch_array($result)){ echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } @@ -108,16 +112,16 @@ ON salesorders.fromstkloc=locations.loccode WHERE orddate >='" . FormatDateForSQL($_POST['FromDate']) . "' AND orddate <='" . FormatDateForSQL($_POST['ToDate']) . "' - GROUP BY salesorders.orderno, - salesorders.debtorno, - salesorders.branchcode, - salesorders.customerref, - salesorders.orddate, - salesorders.fromstkloc, - salesorderdetails.stkcode, - stockmaster.description, - stockmaster.units, - stockmaster.decimalplaces"; + GROUP BY salesorders.orderno, + salesorders.debtorno, + salesorders.branchcode, + salesorders.customerref, + salesorders.orddate, + salesorders.fromstkloc, + salesorderdetails.stkcode, + stockmaster.description, + stockmaster.units, + stockmaster.decimalplaces"; } elseif ($_POST['CategoryID']!='All' AND $_POST['Location']=='All') { @@ -153,17 +157,17 @@ WHERE stockmaster.categoryid ='" . $_POST['CategoryID'] . "' AND orddate >='" . FormatDateForSQL($_POST['FromDate']) . "' AND orddate <='" . FormatDateForSQL($_POST['ToDate']) . "' - GROUP BY salesorders.orderno, - salesorders.debtorno, - salesorders.branchcode, - salesorders.customerref, - salesorders.orddate, - salesorders.fromstkloc, - salesorderdetails.stkcode, - stockmaster.description, - stockmaster.units, - stockmaster.decimalplaces"; - + GROUP BY salesorders.orderno, + salesorders.debtorno, + salesorders.branchcode, + salesorders.customerref, + salesorders.orddate, + salesorders.fromstkloc, + salesorderdetails.stkcode, + stockmaster.description, + stockmaster.units, + stockmaster.decimalplaces"; + } elseif ($_POST['CategoryID']=='All' AND $_POST['Location']!='All') { $sql= "SELECT salesorders.orderno, salesorders.debtorno, @@ -227,7 +231,7 @@ SUM(salesorderdetails.qtyinvoiced) AS totqtyinvoiced INNER JOIN locations ON salesorders.fromstkloc=locations.loccode - FROM salesorders + FROM salesorders INNER JOIN salesorderdetails ON salesorders.orderno = salesorderdetails.orderno INNER JOIN stockmaster @@ -237,20 +241,20 @@ INNER JOIN custbranch ON custbranch.debtorno=salesorders.debtorno AND custbranch.branchcode=salesorders.branchcode - WHERE stockmaster.categoryid ='" . $_POST['CategoryID'] . "' + WHERE stockmaster.categoryid ='" . $_POST['CategoryID'] . "' AND salesorders.fromstkloc ='" . $_POST['Location'] . "' AND orddate >='" . FormatDateForSQL($_POST['FromDate']) . "' AND orddate <='" . FormatDateForSQL($_POST['ToDate']) . "' - GROUP BY salesorders.orderno, - salesorders.debtorno, - salesorders.branchcode, - salesorders.customerref, - salesorders.orddate, - salesorders.fromstkloc, - salesorderdetails.stkcode, - stockmaster.description, - stockmaster.units, - stockmaster.decimalplaces"; + GROUP BY salesorders.orderno, + salesorders.debtorno, + salesorders.branchcode, + salesorders.customerref, + salesorders.orddate, + salesorders.fromstkloc, + salesorderdetails.stkcode, + stockmaster.description, + stockmaster.units, + stockmaster.decimalplaces"; } $sql .= " ORDER BY salesorders.orderno"; Modified: trunk/PDFPeriodStockTransListing.php =================================================================== --- trunk/PDFPeriodStockTransListing.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/PDFPeriodStockTransListing.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -1,7 +1,6 @@ <?php /* $Id: PDFPeriodStockTransListing.php 4307 2010-12-22 16:06:03Z tim_schofield $*/ - include('includes/SQL_CommonFunctions.inc'); include ('includes/session.inc'); @@ -17,8 +16,9 @@ $title = _('Stock Transaction Listing'); include ('includes/header.inc'); - echo '<div class="centre"><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' ' - . _('Stock Transaction Listing').'</img></p></div>'; + echo '<div class="centre"> + <p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . $title . '" alt="">' . ' '. _('Stock Transaction Listing').'</img></p> + </div>'; if ($InputError==1){ prnMsg($msg,'error'); @@ -26,8 +26,8 @@ echo '<form method="post" action="' . $_SERVER['PHP_SELF'] . '">'; echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; - echo '<table class=selection>'; - echo '<tr> + echo '<table class="selection">'; + echo '<tr> <td>' . _('Enter the date from which the transactions are to be listed') . ':</td> <td><input type="text" name="FromDate" maxlength="10" size="10" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" value="' . Date($_SESSION['DefaultDateFormat']) . '"></td> </tr>'; @@ -55,24 +55,28 @@ echo '<tr><td>' . _('For Stock Location') . ':</td> <td><select name="StockLocation">'; - echo '<option VALUE="All">' . _('All') . '</option>'; + echo '<option value="All">' . _('All') . '</option>'; while ($myrow=DB_fetch_array($resultStkLocs)){ if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){ 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']){ - echo '<option selected VALUE="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option selected value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; $_POST['StockLocation']=$myrow['loccode']; } else { - echo '<option VALUE="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } echo '</select></td></tr>'; - echo '</table><br /><div class="centre"><input type=submit name="Go" value="' . _('Create PDF') . '"></div>'; + echo '</table> + <br /> + <div class="centre"> + <input type=submit name="Go" value="' . _('Create PDF') . '" /> + </div>'; include('includes/footer.inc'); exit; @@ -84,43 +88,43 @@ if ($_POST['StockLocation']=='All') { $sql= "SELECT stockmoves.type, - stockmoves.stockid, - stockmaster.description, - stockmaster.decimalplaces, - stockmoves.transno, - stockmoves.trandate, - stockmoves.qty, - stockmoves.reference, - stockmoves.narrative, - locations.locationname - FROM stockmoves - LEFT JOIN stockmaster - ON stockmoves.stockid=stockmaster.stockid - LEFT JOIN locations - ON stockmoves.loccode=locations.loccode - WHERE type='" . $_POST['TransType'] . "' - AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' - AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."'"; + stockmoves.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmoves.transno, + stockmoves.trandate, + stockmoves.qty, + stockmoves.reference, + stockmoves.narrative, + locations.locationname + FROM stockmoves + LEFT JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN locations + ON stockmoves.loccode=locations.loccode + WHERE type='" . $_POST['TransType'] . "' + AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' + AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."'"; } else { $sql= "SELECT stockmoves.type, - stockmoves.stockid, - stockmaster.description, - stockmaster.decimalplaces, - stockmoves.transno, - stockmoves.trandate, - stockmoves.qty, - stockmoves.reference, - stockmoves.narrative, - locations.locationname - FROM stockmoves - LEFT JOIN stockmaster - ON stockmoves.stockid=stockmaster.stockid - LEFT JOIN locations - ON stockmoves.loccode=locations.loccode - WHERE type='" . $_POST['TransType'] . "' - AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' - AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."' - AND stockmoves.loccode='" . $_POST['StockLocation'] . "'"; + stockmoves.stockid, + stockmaster.description, + stockmaster.decimalplaces, + stockmoves.transno, + stockmoves.trandate, + stockmoves.qty, + stockmoves.reference, + stockmoves.narrative, + locations.locationname + FROM stockmoves + LEFT JOIN stockmaster + ON stockmoves.stockid=stockmaster.stockid + LEFT JOIN locations + ON stockmoves.loccode=locations.loccode + WHERE type='" . $_POST['TransType'] . "' + AND date_format(trandate, '%Y-%m-%d')>='".FormatDateForSQL($_POST['FromDate'])."' + AND date_format(trandate, '%Y-%m-%d')<='".FormatDateForSQL($_POST['ToDate'])."' + AND stockmoves.loccode='" . $_POST['StockLocation'] . "'"; } $result=DB_query($sql,$db,'','',false,false); Modified: trunk/PageSecurity.php =================================================================== --- trunk/PageSecurity.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/PageSecurity.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -53,7 +53,11 @@ echo '</table><br />'; -echo '<div class="centre"><input type="submit" name="Update" value="'._('Update Security Levels').'" /></div><br /></form>'; +echo '<div class="centre"> + <input type="submit" name="Update" value="'._('Update Security Levels').'" /> + </div> + <br /> + </form>'; include('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/PaymentAllocations.php =================================================================== --- trunk/PaymentAllocations.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/PaymentAllocations.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -1,14 +1,11 @@ <?php /* $Id$*/ -/* $Revision: 1.6 $ */ + /* This page is called from SupplierInquiry.php when the 'view payments' button is selected */ - -//$PageSecurity = 5; - include('includes/session.inc'); $title = _('Payment Allocations'); @@ -16,17 +13,17 @@ include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); - if (!isset($_GET['SuppID'])){ - prnMsg( _('Supplier ID Number is not Set, can not display result'),'warn'); - include('includes/footer.inc'); - exit; - } +if (!isset($_GET['SuppID'])){ + prnMsg( _('Supplier ID Number is not Set, can not display result'),'warn'); + include('includes/footer.inc'); + exit; +} - if (!isset($_GET['InvID'])){ - prnMsg( _('Invoice Number is not Set, can not display result'),'warn'); - include('includes/footer.inc'); - exit; - } +if (!isset($_GET['InvID'])){ + prnMsg( _('Invoice Number is not Set, can not display result'),'warn'); + include('includes/footer.inc'); + exit; +} $SuppID = $_GET['SuppID']; $InvID = $_GET['InvID']; @@ -34,48 +31,37 @@ echo '<div class="page_help_text">' . _('This shows how the payment to the supplier was allocated') . '<a href="SupplierInquiry.php?&SupplierID=' . $SuppID . '"><br /> ' . _('Back to supplier inquiry') . '</a></div><br />'; -//echo "<br /><font size=4 color=BLUE>Payment Allocation for Supplier: '$SuppID' and Invoice: '$InvID'</font>"; - -// $_SESSION['SuppID'] = new SupplierID; -// $_SESSION['InvID'] = new InvoiceID; - $SQL= "SELECT supptrans.supplierno, - supptrans.suppreference, - supptrans.trandate, - supptrans.alloc - FROM supptrans - WHERE supptrans.id IN (SELECT suppallocs.transid_allocfrom - FROM supptrans, suppallocs - WHERE supptrans.supplierno = '$SuppID' - AND supptrans.suppreference = '$InvID' - AND supptrans.id = suppallocs.transid_allocto)"; + supptrans.suppreference, + supptrans.trandate, + supptrans.alloc, + currencies.decimalplaces + FROM supptrans INNER JOIN suppliers + ON supptrans.supplierno=suppliers.supplierid + INNER JOIN currencies + ON suppliers.currcode=currencies.currabrev + WHERE supptrans.id IN (SELECT suppallocs.transid_allocfrom + FROM supptrans, suppallocs + WHERE supptrans.supplierno = '" . $SuppID . "' + AND supptrans.suppreference = '" . $InvID . "' + AND supptrans.id = suppallocs.transid_allocto)"; -/* -Might be a way of doing this query without a subquery -$SQL= "SELECT supptrans.supplierno, - supptrans.suppreference, - supptrans.trandate, - supptrans.alloc - FROM supptrans INNER JOIN suppallocs ON supptrans.id=suppallocs.transid_allocfrom - WHERE supptrans.supplierno = '$SuppID' - AND supptrans.suppreference = '$InvID' -*/ - $Result = DB_query($SQL, $db); if (DB_num_rows($Result) == 0){ prnMsg(_('There may be a problem retrieving the information. No data is returned'),'warn'); - echo '<br /><a HREF ="javascript:history.back()">' . _('Go back') . '</a>'; + echo '<br /><a href ="javascript:history.back()">' . _('Go back') . '</a>'; include('includes/foooter.inc'); exit; } -echo '<table cellpadding=2 colspan=7 width=80% class=selection>'; -$TableHeader = "<tr> -<th>" . _('Supplier Number') . '<br />' . _('Reference') . "</th> -<th>" . _('Payment') .'<br />' . _('Reference') . "</th> -<th>" . _('Payment') . '<br />' . _('Date') . "</th> -<th>" . _('Total Payment') . '<br />' . _('Amount') . '</th></tr>'; +echo '<table cellpadding="2" colspan="7 width="80%" class="selection">'; +$TableHeader = '<tr> + <th>' . _('Supplier Number') . '<br />' . _('Reference') . '</th> + <th>' . _('Payment') .'<br />' . _('Reference') . '</th> + <th>' . _('Payment') . '<br />' . _('Date') . '</th> + <th>' . _('Total Payment') . '<br />' . _('Amount') . '</th> + </tr>'; echo $TableHeader; @@ -93,7 +79,7 @@ echo '<td>'.$myrow['supplierno'].'</td> <td>'.$myrow['suppreference'].'</td> <td>'.ConvertSQLDate($myrow['trandate']).'</td> - <td class=number>'.number_format($myrow['alloc'],2).'</td> + <td class="number">'.number_format($myrow['alloc'],$myrow['decimalplaces']).'</td> </tr>'; $j++; @@ -106,4 +92,4 @@ echo '</table>'; include('includes/footer.inc'); -?> +?> \ No newline at end of file Modified: trunk/PaymentMethods.php =================================================================== --- trunk/PaymentMethods.php 2011-07-19 09:35:25 UTC (rev 4635) +++ trunk/PaymentMethods.php 2011-07-24 00:14:27 UTC (rev 4636) @@ -62,17 +62,17 @@ // Get the old name and check that the record still exists need to be very careful here $sql = "SELECT paymentname FROM paymentmethods - WHERE paymentid = '" . $SelectedPaymentID . "'"; + WHERE paymentid = '" . $SelectedPaymentID . "'"; $result = DB_query($sql,$db); if ( DB_num_rows($result) != 0 ) { $myrow = DB_fetch_row($result); $OldName = $myrow[0]; $sql = "UPDATE paymentmethods - SET paymentname='" . $_POST['MethodName'] . "', - paymenttype = '" . $_POST['ForPayment'] . "', - receipttype = '" . $_POST['ForReceipt'] . "', - usepreprintedstationery = '" . $_POST['UsePrePrintedStationery']. "' - WHERE paymentname " . LIKE . " '".$OldName."'"; + SET paymentname='" . $_POST['MethodName'] . "', + paymenttype = '" . $_POST['ForPayment'] . "', + receipttype = '" . $_POST['ForReceipt'] . "', + usepreprintedstationery = '" . $_POST['UsePrePrintedStationery']. "' + WHERE paymentname " . LIKE . " '".$OldName."'"; } else { $InputError = 1; @@ -91,17 +91,14 @@ $InputError = 1; prnMsg( _('The payment method can not be created because another with the same name already exists.'),'error'); } else { - $sql = "INSERT INTO paymentmethods ( - paymentname, - paymenttype, - receipttype, - usepreprintedstationery) - VALUES ( - '" . $_POST['MethodName'] ."', - '" . $_POST['ForPayment'] ."', - '" . $_POST['ForReceipt'] ."', - '" . $_POST['UsePrePrintedStationery'] ."' - )"; + $sql = "INSERT INTO paymentmethods ( paymentname, + paymenttype, + receipttype, + usepreprintedstationery) + VALUES ('" . $_POST['MethodName'] ."', + '" . $_POS... [truncated message content] |