|
From: <dai...@us...> - 2010-11-26 09:44:02
|
Revision: 4167
http://web-erp.svn.sourceforge.net/web-erp/?rev=4167&view=rev
Author: daintree
Date: 2010-11-26 09:43:55 +0000 (Fri, 26 Nov 2010)
Log Message:
-----------
bug fixes - style corrections
Modified Paths:
--------------
trunk/PDFBankingSummary.php
trunk/StockCostUpdate.php
trunk/includes/SQL_CommonFunctions.inc
Modified: trunk/PDFBankingSummary.php
===================================================================
--- trunk/PDFBankingSummary.php 2010-11-26 08:43:31 UTC (rev 4166)
+++ trunk/PDFBankingSummary.php 2010-11-26 09:43:55 UTC (rev 4167)
@@ -43,19 +43,19 @@
if (isset($_POST['BatchNo']) and $_POST['BatchNo']!='') {
$SQL= 'SELECT bankaccountname,
- bankaccountnumber,
- ref,
- transdate,
- banktranstype,
- bankact,
- banktrans.exrate,
- banktrans.functionalexrate,
- banktrans.currcode
- FROM bankaccounts,
- banktrans
- WHERE bankaccounts.accountcode=banktrans.bankact
- AND banktrans.transno="' . $_POST['BatchNo'] . '"
- AND banktrans.type=12';
+ bankaccountnumber,
+ ref,
+ transdate,
+ banktranstype,
+ bankact,
+ banktrans.exrate,
+ banktrans.functionalexrate,
+ banktrans.currcode
+ FROM bankaccounts,
+ banktrans
+ WHERE bankaccounts.accountcode=banktrans.bankact
+ AND banktrans.transno="' . $_POST['BatchNo'] . '"
+ AND banktrans.type=12';
$ErrMsg = _('An error occurred getting the header information about the receipt batch number') . ' ' . $_POST['BatchNo'];
$DbgMsg = _('The SQL used to get the receipt header information that failed was');
@@ -81,15 +81,14 @@
$SQL = "SELECT debtorsmaster.name,
- ovamount,
- invtext,
- reference
- FROM debtorsmaster,
- debtortrans
- WHERE debtorsmaster.debtorno=debtortrans.debtorno
- AND debtortrans.transno='" . $_POST['BatchNo'] . "'
- AND debtortrans.type=12";
-
+ ovamount,
+ invtext,
+ reference
+ FROM debtorsmaster INNER JOIN debtortrans
+ ON debtorsmaster.debtorno=debtortrans.debtorno
+ WHERE debtortrans.transno='" . $_POST['BatchNo'] . "'
+ AND debtortrans.type=12";
+
$CustRecs=DB_query($SQL,$db,'','',false,false);
if (DB_error_no($db)!=0){
$title = _('Create PDF Print-out For A Batch Of Receipts');
@@ -102,12 +101,12 @@
exit;
}
$SQL = "SELECT narrative,
- amount
- FROM gltrans
- WHERE gltrans.typeno=" . $_POST['BatchNo'] . "
- AND gltrans.type=12 and gltrans.amount <0
- AND gltrans.account !='" . $myrow['bankact'] . "'
- AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'";
+ amount
+ FROM gltrans
+ WHERE gltrans.typeno='" . $_POST['BatchNo'] . "'
+ AND gltrans.type=12 and gltrans.amount <0
+ AND gltrans.account !='" . $myrow['bankact'] . "'
+ AND gltrans.account !='" . $_SESSION['CompanyRecord']['debtorsact'] . "'";
$GLRecs=DB_query($SQL,$db,'','',false,false);
if (DB_error_no($db)!=0){
@@ -121,16 +120,6 @@
exit;
}
-if (DB_num_rows($GLRecs) == 0){
- $title = _('Create PDF Print-out For A Batch Of Receipts');
- include ('includes/header.inc');
- prnMsg(_('No GL receipts retrieved for batch number') . ' ' . $_POST['BatchNo'], 'warn');
- if ($debug==1){
- prnMsg(_('The SQL used to get the GL receipt information that no any record retrieved') . ':<br>' . $SQL,'error');
- }
- include('includes/footer.inc');
- exit;
-}
include('includes/PDFStarter.php');
@@ -152,7 +141,7 @@
$LeftOvers = $pdf->addTextWrap($Left_Margin+315,$YPos,100,$FontSize,$myrow['reference'], 'left');
$YPos -= ($line_height);
- $TotalBanked = $TotalBanked - $myrow['ovamount'];
+ $TotalBanked -= $myrow['ovamount'];
if ($YPos - (2 *$line_height) < $Bottom_Margin){
/*Then set up a new page */
@@ -162,11 +151,11 @@
/* Right now print out the GL receipt entries in the batch */
while ($myrow=DB_fetch_array($GLRecs)){
-
+
$LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,number_format((-$myrow['amount']*$ExRate*$FunctionalExRate),2), 'right');
$LeftOvers = $pdf->addTextWrap($Left_Margin+65,$YPos,300,$FontSize,$myrow['narrative'], 'left');
$YPos -= ($line_height);
- $TotalBanked = $TotalBanked + (-$myrow['amount']*$ExRate);
+ $TotalBanked += (-$myrow['amount']*$ExRate);
if ($YPos - (2 *$line_height) < $Bottom_Margin){
/*Then set up a new page */
@@ -174,21 +163,11 @@
} /*end of new page header */
} /* end of while there are GL receipts in the batch to print */
+
$YPos-=$line_height;
$LeftOvers = $pdf->addTextWrap($Left_Margin,$YPos,60,$FontSize,number_format($TotalBanked,2), 'right');
$LeftOvers = $pdf->addTextWrap($Left_Margin+65,$YPos,300,$FontSize,_('TOTAL') . ' ' . $Currency . ' ' . _('BANKED'), 'left');
-/* UldisN
-$buf = $pdf->output();
-$len = strlen($buf);
-header('Content-type: application/pdf');
-header('Content-Length: ' . $len);
-header('Content-Disposition: inline; filename=BankingSummary.pdf');
-header('Expires: 0');
-header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-header('Pragma: public');
-$pdf->stream();
-*/
$pdf->OutputD($_SESSION['DatabaseName'] . '_BankingSummary_' . date('Y-m-d').'.pdf');//UldisN
$pdf->__destruct(); //UldisN
}
Modified: trunk/StockCostUpdate.php
===================================================================
--- trunk/StockCostUpdate.php 2010-11-26 08:43:31 UTC (rev 4166)
+++ trunk/StockCostUpdate.php 2010-11-26 09:43:55 UTC (rev 4167)
@@ -17,127 +17,125 @@
$StockID =trim(strtoupper($_POST['StockID']));
}
-echo "<a href='" . $rootpath . '/SelectProduct.php?' . SID . "'>" . _('Back to Items') . '</a><br>';
+echo '<a href="' . $rootpath . '/SelectProduct.php?' . SID . '">' . _('Back to Items') . '</a><br>';
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' .
_('Inventory Adjustment') . '" alt="">' . ' ' . $title . '</p>';
if (isset($_POST['UpdateData'])){
-
- $sql = "SELECT materialcost,
- labourcost,
- overheadcost,
- mbflag,
- sum(quantity) as totalqoh
- FROM stockmaster INNER JOIN locstock
- ON stockmaster.stockid=locstock.stockid
- WHERE stockmaster.stockid='".$StockID."'
- GROUP BY description,
- units,
- lastcost,
- actualcost,
- materialcost,
- labourcost,
- overheadcost,
- mbflag";
- $ErrMsg = _('The entered item code does not exist');
- $oldresult = DB_query($sql,$db,$ErrMsg);
- $oldrow = DB_fetch_array($oldresult);
- $_POST['QOH'] = $oldrow['totalqoh'];
- $_POST['OldMaterialCost'] = $oldrow['materialcost'];
- if ($oldrow['mbflag']=='M') {
- $_POST['OldLabourCost'] = $oldrow['labourcost'];
- $_POST['OldOverheadCost'] = $oldrow['overheadcost'];
+ $sql = "SELECT materialcost,
+ labourcost,
+ overheadcost,
+ mbflag,
+ sum(quantity) as totalqoh
+ FROM stockmaster INNER JOIN locstock
+ ON stockmaster.stockid=locstock.stockid
+ WHERE stockmaster.stockid='".$StockID."'
+ GROUP BY description,
+ units,
+ lastcost,
+ actualcost,
+ materialcost,
+ labourcost,
+ overheadcost,
+ mbflag";
+ $ErrMsg = _('The entered item code does not exist');
+ $OldResult = DB_query($sql,$db,$ErrMsg);
+ $OldRow = DB_fetch_array($OldResult);
+ $_POST['QOH'] = $OldRow['totalqoh'];
+ $_POST['OldMaterialCost'] = $OldRow['materialcost'];
+ if ($OldRow['mbflag']=='M') {
+ $_POST['OldLabourCost'] = $OldRow['labourcost'];
+ $_POST['OldOverheadCost'] = $OldRow['overheadcost'];
} else {
$_POST['OldLabourCost'] = 0;
$_POST['OldOverheadCost'] = 0;
$_POST['LabourCost'] = 0;
$_POST['OverheadCost'] = 0;
}
- DB_free_result($oldresult);
+ DB_free_result($OldResult);
- $OldCost =$_POST['OldMaterialCost'] + $_POST['OldLabourCost'] + $_POST['OldOverheadCost'];
+ $OldCost = $_POST['OldMaterialCost'] + $_POST['OldLabourCost'] + $_POST['OldOverheadCost'];
$NewCost =$_POST['MaterialCost'] + $_POST['LabourCost'] + $_POST['OverheadCost'];
- $result = DB_query("SELECT * FROM stockmaster WHERE stockid='".$StockID."'",$db);
+ $result = DB_query("SELECT * FROM stockmaster WHERE stockid='" . $StockID . "'",$db);
$myrow = DB_fetch_row($result);
if (DB_num_rows($result)==0) {
prnMsg (_('The entered item code does not exist'),'error',_('Non-existent Item'));
} elseif ($OldCost != $NewCost){
- $Result = DB_Txn_Begin($db);
- ItemCostUpdateGL($db, $StockID, $NewCost, $OldCost, $_POST['QOH']);
-
-
+ $Result = DB_Txn_Begin($db);
+ ItemCostUpdateGL($db, $StockID, $NewCost, $OldCost, $_POST['QOH']);
+
$SQL = "UPDATE stockmaster SET
- materialcost='" . $_POST['MaterialCost'] . "',
- labourcost='" . $_POST['LabourCost'] . "',
- overheadcost='" . $_POST['OverheadCost'] . "',
- lastcost='" . $OldCost . "'
- WHERE stockid='" . $StockID . "'";
-
+ materialcost='" . $_POST['MaterialCost'] . "',
+ labourcost='" . $_POST['LabourCost'] . "',
+ overheadcost='" . $_POST['OverheadCost'] . "',
+ lastcost='" . $OldCost . "'
+ WHERE stockid='" . $StockID . "'";
+
$ErrMsg = _('The cost details for the stock item could not be updated because');
$DbgMsg = _('The SQL that failed was');
$Result = DB_query($SQL,$db,$ErrMsg,$DbgMsg,true);
-
+
$Result = DB_Txn_Commit($db);
UpdateCost($db, $StockID); //Update any affected BOMs
- }
+ }
}
$ErrMsg = _('The cost details for the stock item could not be retrieved because');
$DbgMsg = _('The SQL that failed was');
$result = DB_query("SELECT description,
- units,
- lastcost,
- actualcost,
- materialcost,
- labourcost,
- overheadcost,
- mbflag,
- stocktype,
- sum(quantity) as totalqoh
- FROM stockmaster INNER JOIN locstock
- ON stockmaster.stockid=locstock.stockid
- INNER JOIN stockcategory
- ON stockmaster.categoryid = stockcategory.categoryid
- WHERE stockmaster.stockid='" . $StockID . "'
- GROUP BY description,
- units,
- lastcost,
- actualcost,
- materialcost,
- labourcost,
- overheadcost,
- mbflag,
- stocktype",
- $db,$ErrMsg,$DbgMsg);
+ units,
+ lastcost,
+ actualcost,
+ materialcost,
+ labourcost,
+ overheadcost,
+ mbflag,
+ stocktype,
+ sum(quantity) as totalqoh
+ FROM stockmaster INNER JOIN locstock
+ ON stockmaster.stockid=locstock.stockid
+ INNER JOIN stockcategory
+ ON stockmaster.categoryid = stockcategory.categoryid
+ WHERE stockmaster.stockid='" . $StockID . "'
+ GROUP BY description,
+ units,
+ lastcost,
+ actualcost,
+ materialcost,
+ labourcost,
+ overheadcost,
+ mbflag,
+ stocktype",
+ $db,$ErrMsg,$DbgMsg);
+
-
$myrow = DB_fetch_array($result);
-echo "<form action='" . $_SERVER['PHP_SELF'] . "?". SID ."' method=post>";
+echo '<form action="' . $_SERVER['PHP_SELF'] . '?'. SID .'" method=post>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<table cellpadding=2 class=selection>';
-echo "<tr><th colspan=2>"._('Item Code') . ":<input type=text name='StockID' value='$StockID' 1 maxlength=20>";
-echo "<input type=submit name='Show' VALUE='" . _('Show Cost Details') . "'></th></tr>";
-echo "<tr><th colspan=2><font color=navy size=2>" . $StockID . " - " . $myrow['description'] . '</font></th></tr>';
-echo "<tr><th colspan=2><font color=navy size=2>". _('Total Quantity On Hand') . ': ' . $myrow['totalqoh'] . " " . $myrow['units'] ."</font></th></tr>";
+echo '<tr><th colspan=2>' . _('Item Code') . ':<input type="text" name="StockID" value="' . $StockID . '" 1 maxlength=20>';
+echo '<input type="submit" name="Show" VALUE="' . _('Show Cost Details') . '"></th></tr>';
+echo '<tr><th colspan=2><font color=navy size=2>' . $StockID . ' - ' . $myrow['description'] . '</font></th></tr>';
+echo '<tr><th colspan=2><font color=navy size=2>'. _('Total Quantity On Hand') . ': ' . $myrow['totalqoh'] . ' ' . $myrow['units'] .'</font></th></tr>';
if (($myrow['mbflag']=='D' AND $myrow['stocktype'] != 'L')
- OR $myrow['mbflag']=='A'
- OR $myrow['mbflag']=='K'){
+ OR $myrow['mbflag']=='A'
+ OR $myrow['mbflag']=='K'){
echo '</form>'; // Close the form
if ($myrow['mbflag']=='D'){
- echo "<br>$StockID " . _('is a service item');
+ echo '<br>' . $StockID .' ' . _('is a service item');
} else if ($myrow['mbflag']=='A'){
- echo "<br>$StockID " . _('is an assembly part');
+ echo '<br>' . $StockID .' ' . _('is an assembly part');
} else if ($myrow['mbflag']=='K'){
- echo "<br>$StockID " . _('is a kit set part');
+ echo '<br>' . $StockID . ' ' . _('is a kit set part');
}
prnMsg(_('Cost information cannot be modified for kits assemblies or service items') . '. ' . _('Please select a different part'),'warn');
include('includes/footer.inc');
@@ -147,7 +145,7 @@
echo '<input type=hidden name=OldMaterialCost VALUE=' . $myrow['materialcost'] .'>';
echo '<input type=hidden name=OldLabourCost VALUE=' . $myrow['labourcost'] .'>';
echo '<input type=hidden name=OldOverheadCost VALUE=' . $myrow['overheadcost'] .">";
-echo '<input type=hidden name=QOH VALUE=' . $myrow['totalqoh'] .'>';
+echo '<input type=hidden name="QOH" VALUE=' . $myrow['totalqoh'] .'>';
echo '<tr><td>' . _('Last Cost') .':</td><td class=number>' . number_format($myrow['lastcost'],2) . '</td></tr>';
if (! in_array($UpdateSecurity,$_SESSION['AllowedPageSecurityTokens']) OR !isset($UpdateSecurity)){
@@ -165,14 +163,14 @@
echo '<input type=hidden name=LabourCost VALUE=0>';
echo '<input type=hidden name=OverheadCost VALUE=0>';
}
- echo "</table><br /><div class='centre'><input type=submit name='UpdateData' VALUE='" . _('Update') . "'><br /><br />";
+ echo '</table><br /><div class="centre"><input type="submit" name="UpdateData" VALUE="' . _('Update') . '"><br /><br />';
}
if ($myrow['mbflag']!='D'){
- echo "<a href='$rootpath/StockStatus.php?" . SID . "&StockID=$StockID'>" . _('Show Stock Status') . '</a>';
- echo "<br><a href='$rootpath/StockMovements.php?" . SID . "&StockID=$StockID'>" . _('Show Stock Movements') . '</a>';
- echo "<br><a href='$rootpath/StockUsage.php?" . SID . "&StockID=$StockID'>" . _('Show Stock Usage') .'</a>';
- echo "<br><a href='$rootpath/SelectSalesOrder.php?" . SID . "&SelectedStockItem=$StockID'>" . _('Search Outstanding Sales Orders') . '</a>';
- echo "<br><a href='$rootpath/SelectCompletedOrder.php?" . SID . "&SelectedStockItem=$StockID'>" . _('Search Completed Sales Orders') . '</a>';
+ echo '<a href="' . $rootpath . '/StockStatus.php?' . SID . '&StockID=' . $StockID . '>' . _('Show Stock Status') . '</a>';
+ echo '<br><a href="' . $rootpath . '/StockMovements.php?' . SID . '&StockID=' . $StockID . '">' . _('Show Stock Movements') . '</a>';
+ echo '<br><a href="' . $rootpath . '/StockUsage.php?' . SID . '&StockID=' . $StockID . '">' . _('Show Stock Usage') .'</a>';
+ echo '<br><a href="' . $rootpath . '/SelectSalesOrder.php?' . SID . '&SelectedStockItem=' . $StockID . '">' . _('Search Outstanding Sales Orders') . '</a>';
+ echo '<br><a href="' . $rootpath . '/SelectCompletedOrder.php?' . SID . '&SelectedStockItem=' . $StockID . '">' . _('Search Completed Sales Orders') . '</a>';
}
echo '</form></div>';
include('includes/footer.inc');
Modified: trunk/includes/SQL_CommonFunctions.inc
===================================================================
--- trunk/includes/SQL_CommonFunctions.inc 2010-11-26 08:43:31 UTC (rev 4166)
+++ trunk/includes/SQL_CommonFunctions.inc 2010-11-26 09:43:55 UTC (rev 4167)
@@ -16,9 +16,9 @@
*/
- DB_query("LOCK TABLES systypes WRITE",$db);
+ DB_query('LOCK TABLES systypes WRITE',$db);
- $SQL = "SELECT typeno FROM systypes WHERE typeid = " . $TransType;
+ $SQL = 'SELECT typeno FROM systypes WHERE typeid = ' . $TransType;
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': <BR>' . _('The next transaction number could not be retrieved from the database because');
$DbgMsg = _('The following SQL to retrieve the transaction number was used');
@@ -63,9 +63,9 @@
$QuerySQL = "SELECT taxrate
FROM taxauthrates
- WHERE taxauthority=" . $TaxAuthority . "
- AND dispatchtaxprovince=" . $DispatchTaxProvince . "
- AND taxcatid = " . $TaxCategory;
+ WHERE taxauthority='" . $TaxAuthority . "'
+ AND dispatchtaxprovince='" . $DispatchTaxProvince . "'
+ AND taxcatid = '" . $TaxCategory . "'";
$ErrMsg = _('The tax rate for this item could not be retrieved because');
$GetTaxRateResult = DB_query($QuerySQL,$db,$ErrMsg);
@@ -92,9 +92,9 @@
taxauthrates.taxauthority=taxgrouptaxes.taxauthid
INNER JOIN taxauthorities ON
taxauthrates.taxauthority=taxauthorities.taxid
- WHERE taxgrouptaxes.taxgroupid=" . $TaxGroup . "
- AND taxauthrates.dispatchtaxprovince=" . $DispatchTaxProvince . "
- AND taxauthrates.taxcatid = " . $TaxCategory . "
+ WHERE taxgrouptaxes.taxgroupid='" . $TaxGroup . "'
+ AND taxauthrates.dispatchtaxprovince='" . $DispatchTaxProvince . "'
+ AND taxauthrates.taxcatid = '" . $TaxCategory . "'
ORDER BY taxgrouptaxes.calculationorder";
@@ -162,7 +162,7 @@
if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND $QOH!=0){
$CostUpdateNo = GetNextTransNo(35, $db);
- $PeriodNo = GetPeriod(Date('d/m/Y'), $db);
+ $PeriodNo = GetPeriod($_SESSION['DefaultDateFormat'], $db);
$StockGLCode = GetStockGLCode($StockID,$db);
$ValueOfChange = $QOH * ($NewCost - $OldCost);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|