|
From: <dai...@us...> - 2011-07-19 09:35:34
|
Revision: 4635
http://web-erp.svn.sourceforge.net/web-erp/?rev=4635&view=rev
Author: daintree
Date: 2011-07-19 09:35:25 +0000 (Tue, 19 Jul 2011)
Log Message:
-----------
consistency
Modified Paths:
--------------
trunk/CounterSales.php
trunk/CustomerInquiry.php
trunk/FixedAssetItems.php
trunk/FixedAssetRegister.php
trunk/FixedAssetTransfer.php
trunk/InventoryPlanning.php
trunk/InventoryPlanningPrefSupplier.php
trunk/InventoryQuantities.php
trunk/InventoryValuation.php
trunk/Labels.php
trunk/Locations.php
trunk/MRP.php
trunk/MRPCalendar.php
trunk/MRPCreateDemands.php
trunk/MRPDemandTypes.php
trunk/MRPDemands.php
trunk/MRPPlannedWorkOrders.php
trunk/MRPShortages.php
trunk/MailInventoryValuation.php
trunk/MailSalesReport.php
trunk/MailSalesReport_csv.php
trunk/SelectCustomer.php
trunk/css/fresh/default.css
trunk/index.php
trunk/javascripts/MiscFunctions.js
Modified: trunk/CounterSales.php
===================================================================
--- trunk/CounterSales.php 2011-07-17 03:31:55 UTC (rev 4634)
+++ trunk/CounterSales.php 2011-07-19 09:35:25 UTC (rev 4635)
@@ -84,30 +84,37 @@
include('includes/footer.inc');
exit;
}
-
- $_SESSION['Items'.$identifier]->Branch = $myrow['cashsalebranch'];
- $_SESSION['Items'.$identifier]->DebtorNo = $myrow['cashsalecustomer'];
+ if (isset($_GET['DebtorNo'])) {
+ $_SESSION['Items'.$identifier]->DebtorNo = $_GET['DebtorNo'];
+ $_SESSION['Items'.$identifier]->Branch = $_GET['BranchNo'];
+ } else {
+ $_SESSION['Items'.$identifier]->Branch = $myrow['cashsalebranch'];
+ $_SESSION['Items'.$identifier]->DebtorNo = $myrow['cashsalecustomer'];
+ }
+
$_SESSION['Items'.$identifier]->LocationName = $myrow['locationname'];
$_SESSION['Items'.$identifier]->Location = $_SESSION['UserStockLocation'];
$_SESSION['Items'.$identifier]->DispatchTaxProvince = $myrow['taxprovinceid'];
// Now check to ensure this account exists and set defaults */
$sql = "SELECT debtorsmaster.name,
- holdreasons.dissallowinvoices,
- debtorsmaster.salestype,
- salestypes.sales_type,
- debtorsmaster.currcode,
- debtorsmaster.customerpoline,
- paymentterms.terms
- FROM debtorsmaster,
- holdreasons,
- salestypes,
- paymentterms
- WHERE debtorsmaster.salestype=salestypes.typeabbrev
- AND debtorsmaster.holdreason=holdreasons.reasoncode
- AND debtorsmaster.paymentterms=paymentterms.termsindicator
- AND debtorsmaster.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'";
-
+ holdreasons.dissallowinvoices,
+ debtorsmaster.salestype,
+ salestypes.sales_type,
+ debtorsmaster.currcode,
+ debtorsmaster.customerpoline,
+ paymentterms.terms,
+ currencies.decimalplaces
+ FROM debtorsmaster INNER JOIN holdreasons
+ ON debtorsmaster.holdreason=holdreasons.reasoncode
+ INNER JOIN salestypes
+ ON debtorsmaster.salestype=salestypes.typeabbrev
+ INNER JOIN paymentterms
+ ON debtorsmaster.paymentterms=paymentterms.termsindicator
+ INNER JOIN currencies
+ ON debtorsmaster.currcode=currencies.currabrev
+ WHERE debtorsmaster.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'";
+
$ErrMsg = _('The details of the customer selected') . ': ' . $_SESSION['Items'.$identifier]->DebtorNo . ' ' . _('cannot be retrieved because');
$DbgMsg = _('The SQL used to retrieve the customer details and failed was') . ':';
// echo $sql;
@@ -127,7 +134,7 @@
$_SESSION['Items'.$identifier]->DefaultCurrency = $myrow['currcode'];
$_SESSION['Items'.$identifier]->DefaultPOLine = $myrow['customerpoline'];
$_SESSION['Items'.$identifier]->PaymentTerms = $myrow['terms'];
-
+ $_SESSION['Items'.$identifier]->CurrDecimalPlaces = $myrow['decimalplaces'];
/* now get the branch defaults from the customer branches table CustBranch. */
$sql = "SELECT custbranch.brname,
@@ -208,7 +215,7 @@
} else { /*Not cancelling the order */
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Counter Sales') . '" alt="" />' . ' ';
- echo _('Counter Sale') . ' - ' . $_SESSION['Items'.$identifier]->LocationName . ' (' . _('all amounts in') . ' ' . $_SESSION['Items'.$identifier]->DefaultCurrency . ')';
+ echo $_SESSION['Items'.$identifier]->CustomerName . ' ' . _('Counter Sale') . ' ' ._('from') . ' ' . $_SESSION['Items'.$identifier]->LocationName . ' ' . _('inventory') . ' (' . _('all amounts in') . ' ' . $_SESSION['Items'.$identifier]->DefaultCurrency . ')';
echo '</p>';
}
@@ -228,30 +235,30 @@
if ($_POST['StockCat']=='All'){
$SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster,
- stockcategory
- WHERE stockmaster.categoryid=stockcategory.categoryid
- AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.description " . LIKE . " '" . $SearchString . "'
- AND stockmaster.discontinued=0
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster,
+ stockcategory
+ WHERE stockmaster.categoryid=stockcategory.categoryid
+ AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ AND stockmaster.mbflag <>'G'
+ AND stockmaster.controlled <> 1
+ AND stockmaster.description " . LIKE . " '" . $SearchString . "'
+ AND stockmaster.discontinued=0
+ ORDER BY stockmaster.stockid";
} else {
$SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster, stockcategory
- WHERE stockmaster.categoryid=stockcategory.categoryid
- AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.discontinued=0
- AND stockmaster.description " . LIKE . " '" . $SearchString . "'
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster, stockcategory
+ WHERE stockmaster.categoryid=stockcategory.categoryid
+ AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ AND stockmaster.mbflag <>'G'
+ AND stockmaster.controlled <> 1
+ AND stockmaster.discontinued=0
+ AND stockmaster.description " . LIKE . " '" . $SearchString . "'
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid";
}
} else if (mb_strlen($_POST['StockCode'])>0){
@@ -261,55 +268,55 @@
if ($_POST['StockCat']=='All'){
$SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster, stockcategory
- WHERE stockmaster.categoryid=stockcategory.categoryid
- AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.stockid " . LIKE . " '" . $SearchString . "'
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.discontinued=0
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster, stockcategory
+ WHERE stockmaster.categoryid=stockcategory.categoryid
+ AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ AND stockmaster.stockid " . LIKE . " '" . $SearchString . "'
+ AND stockmaster.mbflag <>'G'
+ AND stockmaster.controlled <> 1
+ AND stockmaster.discontinued=0
+ ORDER BY stockmaster.stockid";
} else {
$SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster, stockcategory
- WHERE stockmaster.categoryid=stockcategory.categoryid
- AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.stockid " . LIKE . " '" . $SearchString . "'
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.discontinued=0
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster, stockcategory
+ WHERE stockmaster.categoryid=stockcategory.categoryid
+ AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ AND stockmaster.stockid " . LIKE . " '" . $SearchString . "'
+ AND stockmaster.mbflag <>'G'
+ AND stockmaster.controlled <> 1
+ AND stockmaster.discontinued=0
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid";
}
} else {
if ($_POST['StockCat']=='All'){
$SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster, stockcategory
- WHERE stockmaster.categoryid=stockcategory.categoryid
- AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.discontinued=0
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster, stockcategory
+ WHERE stockmaster.categoryid=stockcategory.categoryid
+ AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ AND stockmaster.mbflag <>'G'
+ AND stockmaster.controlled <> 1
+ AND stockmaster.discontinued=0
+ ORDER BY stockmaster.stockid";
} else {
$SQL = "SELECT stockmaster.stockid,
- stockmaster.description,
- stockmaster.units
- FROM stockmaster, stockcategory
- WHERE stockmaster.categoryid=stockcategory.categoryid
- AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
- AND stockmaster.mbflag <>'G'
- AND stockmaster.controlled <> 1
- AND stockmaster.discontinued=0
- AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
- ORDER BY stockmaster.stockid";
+ stockmaster.description,
+ stockmaster.units
+ FROM stockmaster, stockcategory
+ WHERE stockmaster.categoryid=stockcategory.categoryid
+ AND (stockcategory.stocktype='F' OR stockcategory.stocktype='D')
+ AND stockmaster.mbflag <>'G'
+ AND stockmaster.controlled <> 1
+ AND stockmaster.discontinued=0
+ AND stockmaster.categoryid='" . $_POST['StockCat'] . "'
+ ORDER BY stockmaster.stockid";
}
}
@@ -345,7 +352,7 @@
/* Always do the stuff below */
-echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID .'identifier='.$identifier . '" name="SelectParts" method="post">';
+echo '<form action="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '" name="SelectParts" method="post">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
//Get The exchange rate used for GPPercent calculations on adding or amending items
@@ -373,7 +380,10 @@
$Discount = 0;
$i=1;
- while ($i<=$_SESSION['QuickEntries'] and isset($_POST['part_' . $i]) and $_POST['part_' . $i]!='') {
+ while ($i<=$_SESSION['QuickEntries']
+ AND isset($_POST['part_' . $i])
+ AND $_POST['part_' . $i]!='') {
+
$QuickEntryCode = 'part_' . $i;
$QuickEntryQty = 'qty_' . $i;
$QuickEntryPOLine = 'poline_' . $i;
@@ -409,9 +419,10 @@
$NewItemDue = DateAdd (Date($_SESSION['DefaultDateFormat']),'d', $_SESSION['Items'.$identifier]->DeliveryDays);
}
/*Now figure out if the item is a kit set - the field MBFlag='K'*/
- $sql = "SELECT stockmaster.mbflag, stockmaster.controlled
- FROM stockmaster
- WHERE stockmaster.stockid='". $NewItem ."'";
+ $sql = "SELECT stockmaster.mbflag,
+ stockmaster.controlled
+ FROM stockmaster
+ WHERE stockmaster.stockid='". $NewItem ."'";
$ErrMsg = _('Could not determine if the part being ordered was a kitset or not because');
$DbgMsg = _('The sql that was used to determine if the part being ordered was a kitset or not was ');
@@ -423,11 +434,11 @@
} elseif ($myrow=DB_fetch_array($KitResult)){
if ($myrow['mbflag']=='K'){ /*It is a kit set item */
$sql = "SELECT bom.component,
- bom.quantity
- FROM bom
- WHERE bom.parent='" . $NewItem . "'
- AND bom.effectiveto > '" . Date('Y-m-d') . "'
- AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
+ bom.quantity
+ FROM bom
+ WHERE bom.parent='" . $NewItem . "'
+ AND bom.effectiveto > '" . Date('Y-m-d') . "'
+ AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
$ErrMsg = _('Could not retrieve kitset components from the database because') . ' ';
$KitResult = DB_query($sql,$db,$ErrMsg,$DbgMsg);
@@ -515,9 +526,9 @@
foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) {
$NewItem=$OrderLine->StockID;
$sql = "SELECT stockmaster.mbflag,
- stockmaster.controlled
- FROM stockmaster
- WHERE stockmaster.stockid='". $OrderLine->StockID."'";
+ stockmaster.controlled
+ FROM stockmaster
+ WHERE stockmaster.stockid='". $OrderLine->StockID."'";
$ErrMsg = _('Could not determine if the part being ordered was a kitset or not because');
$DbgMsg = _('The sql that was used to determine if the part being ordered was a kitset or not was ');
@@ -525,12 +536,12 @@
if ($myrow=DB_fetch_array($KitResult)){
if ($myrow['mbflag']=='K'){ /*It is a kit set item */
$sql = "SELECT bom.component,
- bom.quantity
- FROM bom
- WHERE bom.parent='" . $OrderLine->StockID. "'
- AND bom.effectiveto > '" . Date('Y-m-d') . "'
- AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
-
+ bom.quantity
+ FROM bom
+ WHERE bom.parent='" . $OrderLine->StockID. "'
+ AND bom.effectiveto > '" . Date('Y-m-d') . "'
+ AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
+
$ErrMsg = _('Could not retrieve kitset components from the database because');
$KitResult = DB_query($sql,$db,$ErrMsg);
@@ -559,9 +570,9 @@
* controlled items and ghost/phantom items cannot be selected because the SQL to show items to select doesn't show 'em
* */
$sql = "SELECT stockmaster.mbflag,
- stockmaster.taxcatid
- FROM stockmaster
- WHERE stockmaster.stockid='". $NewItem ."'";
+ stockmaster.taxcatid
+ FROM stockmaster
+ WHERE stockmaster.stockid='". $NewItem ."'";
$ErrMsg = _('Could not determine if the part being ordered was a kitset or not because');
@@ -573,12 +584,12 @@
if ($myrow=DB_fetch_array($KitResult)){
if ($myrow['mbflag']=='K'){ /*It is a kit set item */
$sql = "SELECT bom.component,
- bom.quantity
- FROM bom
- WHERE bom.parent='" . $NewItem . "'
- AND bom.effectiveto > '" . Date('Y-m-d') . "'
- AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
-
+ bom.quantity
+ FROM bom
+ WHERE bom.parent='" . $NewItem . "'
+ AND bom.effectiveto > '" . Date('Y-m-d') . "'
+ AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
+
$ErrMsg = _('Could not retrieve kitset components from the database because');
$KitResult = DB_query($sql,$db,$ErrMsg);
@@ -610,8 +621,8 @@
foreach($NewItemArray as $NewItem => $NewItemQty) {
if($NewItemQty > 0) {
$sql = "SELECT stockmaster.mbflag
- FROM stockmaster
- WHERE stockmaster.stockid='". $NewItem ."'";
+ FROM stockmaster
+ WHERE stockmaster.stockid='". $NewItem ."'";
$ErrMsg = _('Could not determine if the part being ordered was a kitset or not because');
@@ -625,9 +636,9 @@
$sql = "SELECT bom.component,
bom.quantity
FROM bom
- WHERE bom.parent='" . $NewItem . "'
- AND bom.effectiveto > '" . Date('Y-m-d') . "'
- AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
+ WHERE bom.parent='" . $NewItem . "'
+ AND bom.effectiveto > '" . Date('Y-m-d') . "'
+ AND bom.effectiveafter < '" . Date('Y-m-d') . "'";
$ErrMsg = _('Could not retrieve kitset components from the database because');
$KitResult = DB_query($sql,$db,$ErrMsg);
@@ -659,7 +670,7 @@
$counter =0;
foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) {
- if ($OrderLine->DiscCat !="" AND ! in_array($OrderLine->DiscCat,$DiscCatsDone)){
+ if ($OrderLine->DiscCat !='' AND ! in_array($OrderLine->DiscCat,$DiscCatsDone)){
$DiscCatsDone[$counter]=$OrderLine->DiscCat;
$QuantityOfDiscCat =0;
@@ -670,10 +681,10 @@
}
}
$result = DB_query("SELECT MAX(discountrate) AS discount
- FROM discountmatrix
- WHERE salestype='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "'
- AND discountcategory ='" . $OrderLine->DiscCat . "'
- AND quantitybreak <'" . $QuantityOfDiscCat . "'",$db);
+ FROM discountmatrix
+ WHERE salestype='" . $_SESSION['Items'.$identifier]->DefaultSalesType . "'
+ AND discountcategory ='" . $OrderLine->DiscCat . "'
+ AND quantitybreak <'" . $QuantityOfDiscCat . "'",$db);
$myrow = DB_fetch_row($result);
if ($myrow[0]!=0){ /* need to update the lines affected */
foreach ($_SESSION['Items'.$identifier]->LineItems as $StkItems_2) {
@@ -686,7 +697,8 @@
}
} /* end of discount matrix lookup code */
-if (count($_SESSION['Items'.$identifier]->LineItems)>0 and !isset($_POST['ProcessSale'])){ /*only show order lines if there are any */
+if (count($_SESSION['Items'.$identifier]->LineItems)>0
+ AND !isset($_POST['ProcessSale'])){ /*only show order lines if there are any */
/*
// *************************************************************************
// T H I S W H E R E T H E S A L E I S D I S P L A Y E D
@@ -738,7 +750,7 @@
echo '<input type="hidden" name="POLine_' . $OrderLine->LineNumber . '" value="" />';
echo '<input type="hidden" name="ItemDue_' . $OrderLine->LineNumber . '" value="'.$OrderLine->ItemDue.'" />';
- echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?' . SID .'identifier='.$identifier . '&StockID=' . $OrderLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $OrderLine->StockID . '</a></td>
+ echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?identifier='.$identifier . '&StockID=' . $OrderLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $OrderLine->StockID . '</a></td>
<td>' . $OrderLine->ItemDescription . '</td>';
echo '<td><input class="number" tabindex="2" type="text" name="Quantity_' . $OrderLine->LineNumber . '" size="6" maxlength="6" value="' . $OrderLine->Quantity . '" />';
@@ -750,7 +762,7 @@
echo '<td><input class="number" type="text" name="Price_' . $OrderLine->LineNumber . '" size="16" maxlength="16" value="' . $OrderLine->Price . '" /></td>
<td><input class="number" type="text" name="Discount_' . $OrderLine->LineNumber . '" size="5" maxlength="4" value="' . ($OrderLine->DiscountPercent * 100) . '" /></td>
<td><input class="number" type="text" name="GPPercent_' . $OrderLine->LineNumber . '" size="3" maxlength="40" value="' . $OrderLine->GPPercent . '" /></td>';
- echo '<td class="number">' . number_format($SubTotal,2) . '</td>';
+ echo '<td class="number">' . number_format($SubTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>';
$LineDueDate = $OrderLine->ItemDue;
if (!Is_Date($OrderLine->ItemDue)){
$LineDueDate = DateAdd (Date($_SESSION['DefaultDateFormat']),'d', $_SESSION['Items'.$identifier]->DeliveryDays);
@@ -776,9 +788,9 @@
$TaxTotal += $TaxLineTotal;
$_SESSION['Items'.$identifier]->TaxTotals=$TaxTotals;
$_SESSION['Items'.$identifier]->TaxGLCodes=$TaxGLCodes;
- echo '<td class="number">' . number_format($TaxLineTotal ,2) . '</td>';
- echo '<td class="number">' . number_format($SubTotal + $TaxLineTotal ,2) . '</td>';
- echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID .'&identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete') . '</a></td></tr>';
+ echo '<td class="number">' . number_format($TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>';
+ echo '<td class="number">' . number_format($SubTotal + $TaxLineTotal ,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>';
+ echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . _('Delete') . '</a></td></tr>';
if ($_SESSION['AllowOrderLineItemNarrative'] == 1){
echo $RowStarter;
@@ -794,9 +806,9 @@
} /* end of loop around items */
echo '<tr class="EvenTableRows"><td colspan="8" class="number"><b>' . _('Total') . '</b></td>
- <td class="number">' . number_format(($_SESSION['Items'.$identifier]->total),2) . '</td>
- <td class="number">' . number_format($TaxTotal,2) . '</td>
- <td class="number">' . number_format(($_SESSION['Items'.$identifier]->total+$TaxTotal),2) . '</td>
+ <td class="number">' . number_format(($_SESSION['Items'.$identifier]->total),$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>
+ <td class="number">' . number_format($TaxTotal,$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>
+ <td class="number">' . number_format(($_SESSION['Items'.$identifier]->total+$TaxTotal),$_SESSION['Items'.$identifier]->CurrDecimalPlaces) . '</td>
</tr>
</table>';
echo '<input type="hidden" name="TaxTotal" value="'.$TaxTotal.'" />';
@@ -1938,9 +1950,9 @@
echo '<br /><div class="centre">';
if ($_SESSION['InvoicePortraitFormat']==0){
- echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$rootpath.'/PrintCustTrans.php?' . SID . 'FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">'. _('Print this invoice'). ' (' . _('Landscape') . ')</a><br /><br />';
+ echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$rootpath.'/PrintCustTrans.php?FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">'. _('Print this invoice'). ' (' . _('Landscape') . ')</a><br /><br />';
} else {
- echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$rootpath.'/PrintCustTransPortrait.php?' . SID . 'FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">'. _('Print this invoice'). ' (' . _('Portrait') . ')</a><br /><br />';
+ echo '<img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" />' . ' ' . '<a target="_blank" href="'.$rootpath.'/PrintCustTransPortrait.php?FromTransNo='.$InvoiceNo.'&InvOrCredit=Invoice&PrintPDF=True">'. _('Print this invoice'). ' (' . _('Portrait') . ')</a><br /><br />';
}
echo '<br /><br /><a href="' .$_SERVER['PHP_SELF'] . '">' . _('Start a new Counter Sale') . '</a></div>';
@@ -2077,7 +2089,7 @@
<td style="text-align:center">%s</td>
<td style="text-align:center">%s</td>
<td style="text-align:center">%s</td>
- <td><font size=1><input class="number" tabindex="'.number_format($j+7).'" type="textbox" size="6" name="itm'.$myrow['stockid'].'" value="0" />
+ <td><font size=1><input class="number" tabindex="'.number_format($j+7).'" type="textbox" size="6" name="itm%s" value="0" />
</td>
</tr>',
$myrow['stockid'],
@@ -2087,9 +2099,6 @@
$DemandQty,
$OnOrder,
$Available,
- $ImageSource,
- $rootpath,
- SID,
$myrow['stockid']);
if ($j==1) {
$jsCall = '<script type="text/javascript">if (document.SelectParts) {defaultControl(document.SelectParts.itm'.$myrow['stockid'].');}</script>';
@@ -2110,20 +2119,20 @@
echo '<table class="selection"><tr><td><b>' . _('Select a Stock Category') . ': </b><select tabindex="1" name="StockCat">';
if (!isset($_POST['StockCat'])){
- echo "<option selected='True' value='All'>" . _('All').'</option>';
+ echo '<option selected="true" value="All">' . _('All').'</option>';
$_POST['StockCat'] ='All';
} else {
- echo "<option value='All'>" . _('All').'</option>';
+ echo '<option value="All">' . _('All').'</option>';
}
$SQL="SELECT categoryid,
- categorydescription
- FROM stockcategory
- WHERE stocktype='F' OR stocktype='D'
- ORDER BY categorydescription";
+ categorydescription
+ FROM stockcategory
+ WHERE stocktype='F' OR stocktype='D'
+ ORDER BY categorydescription";
$result1 = DB_query($SQL,$db);
while ($myrow1 = DB_fetch_array($result1)) {
if ($_POST['StockCat']==$myrow1['categoryid']){
- echo '<option selected="True" value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>';
+ echo '<option selected="true" value="' . $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>';
} else {
echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'].'</option>';
}
@@ -2180,22 +2189,22 @@
// Find the quantity in stock at location
$QOHSql = "SELECT sum(quantity) AS QOH,
- stockmaster.decimalplaces
- FROM locstock INNER JOIN stockmaster
- WHERE locstock.stockid='" .$myrow['stockid'] . "'
- AND loccode = '" . $_SESSION['Items'.$identifier]->Location . "'";
+ stockmaster.decimalplaces
+ FROM locstock INNER JOIN stockmaster
+ WHERE locstock.stockid='" .$myrow['stockid'] . "'
+ AND loccode = '" . $_SESSION['Items'.$identifier]->Location . "'";
$QOHResult = DB_query($QOHSql,$db);
$QOHRow = DB_fetch_array($QOHResult);
$QOH = $QOHRow['QOH'];
// Find the quantity on outstanding sales orders
$sql = "SELECT SUM(salesorderdetails.quantity-salesorderdetails.qtyinvoiced) AS dem
- FROM salesorderdetails INNER JOIN salesorders
- ON salesorders.orderno = salesorderdetails.orderno
- WHERE salesorders.fromstkloc='" . $_SESSION['Items'.$identifier]->Location . "'
- AND salesorderdetails.completed=0
- AND salesorders.quotation=0
- AND salesorderdetails.stkcode='" . $myrow['stockid'] . "'";
+ FROM salesorderdetails INNER JOIN salesorders
+ ON salesorders.orderno = salesorderdetails.orderno
+ WHERE salesorders.fromstkloc='" . $_SESSION['Items'.$identifier]->Location . "'
+ AND salesorderdetails.completed=0
+ AND salesorders.quotation=0
+ AND salesorderdetails.stkcode='" . $myrow['stockid'] . "'";
$ErrMsg = _('The demand for this product from') . ' ' . $_SESSION['Items'.$identifier]->Location . ' ' . _('cannot be retrieved because');
$DemandResult = DB_query($sql,$db,$ErrMsg);
@@ -2227,8 +2236,8 @@
// Find the quantity on works orders
$sql = "SELECT SUM(woitems.qtyreqd - woitems.qtyrecd) AS dedm
- FROM woitems
- WHERE stockid='" . $myrow['stockid'] ."'";
+ FROM woitems
+ WHERE stockid='" . $myrow['stockid'] ."'";
$ErrMsg = _('The order details for this product cannot be retrieved because');
$WoResult = db_query($sql,$db,$ErrMsg);
@@ -2251,26 +2260,22 @@
$Available = $qoh - $DemandQty + $OnOrder;
printf('<td>%s</td>
- <td>%s</td>
- <td>%s</td>
- <td class="number">%s</td>
- <td class="number">%s</td>
- <td class="number">%s</td>
- <td class="number">%s</td>
- <td><font size="1"><input class="number" tabindex="'.number_format($j+7).'" type="textbox" size="6" name="itm'.$myrow['stockid'].'" value="0" />
- </font></td>
- </tr>',
- $myrow['stockid'],
- $myrow['description'],
- $myrow['units'],
- number_format($QOH, $QOHRow['decimalplaces']),
- number_format($DemandQty, $QOHRow['decimalplaces']),
- number_format($OnOrder, $QOHRow['decimalplaces']),
- number_format($Available, $QOHRow['decimalplaces']),
- $ImageSource,
- $rootpath,
- SID,
- $myrow['stockid']);
+ <td>%s</td>
+ <td>%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td class="number">%s</td>
+ <td><font size="1"><input class="number" tabindex="'.number_format($j+7).'" type="textbox" size="6" name="itm%s" value="0" /></font></td>
+ </tr>',
+ $myrow['stockid'],
+ $myrow['description'],
+ $myrow['units'],
+ number_format($QOH, $QOHRow['decimalplaces']),
+ number_format($DemandQty, $QOHRow['decimalplaces']),
+ number_format($OnOrder, $QOHRow['decimalplaces']),
+ number_format($Available, $QOHRow['decimalplaces']),
+ $myrow['stockid']);
if ($j==1) {
$jsCall = '<script type="text/javascript">if (document.SelectParts) {defaultControl(document.SelectParts.itm'.$myrow['stockid'].');}</script>';
}
@@ -2295,12 +2300,12 @@
else { /* show the quick entry form variable */
echo '<div class="page_help_text"><b>' . _('Use this form to add items quickly if the item codes are already known') . '</b></div><br />
- <table border="1">
- <tr>';
+ <table border="1">
+ <tr>';
/*do not display colum unless customer requires po line number by sales order line*/
echo '<th>' . _('Item Code') . '</th>
- <th>' . _('Quantity') . '</th>
- </tr>';
+ <th>' . _('Quantity') . '</th>
+ </tr>';
$DefaultDeliveryDate = DateAdd(Date($_SESSION['DefaultDateFormat']),'d',$_SESSION['Items'.$identifier]->DeliveryDays);
if (count($_SESSION['Items'.$identifier]->LineItems)==0) {
echo '<input type="hidden" name="CustRef" value="'.$_SESSION['Items'.$identifier]->CustRef.'" />';
@@ -2315,8 +2320,7 @@
/* Do not display colum unless customer requires po line number by sales order line*/
echo '<td><input type="text" name="part_' . $i . '" size="21" maxlength="20" /></td>
<td><input type="text" class="number" name="qty_' . $i . '" size="6" maxlength="6" /></td>
- <input type="hidden" class="date" name="ItemDue_' . $i . '"
- value="' . $DefaultDeliveryDate . '" /></tr>';
+ <input type="hidden" class="date" name="ItemDue_' . $i . '" value="' . $DefaultDeliveryDate . '" /></tr>';
}
echo '<script type="text/javascript">if (document.SelectParts) {defaultControl(document.SelectParts.part_1);}</script>';
@@ -2330,4 +2334,4 @@
}
echo '</form>';
include('includes/footer.inc');
-?>
+?>
\ No newline at end of file
Modified: trunk/CustomerInquiry.php
===================================================================
--- trunk/CustomerInquiry.php 2011-07-17 03:31:55 UTC (rev 4634)
+++ trunk/CustomerInquiry.php 2011-07-19 09:35:25 UTC (rev 4635)
@@ -103,7 +103,7 @@
INNER JOIN holdreasons
ON debtorsmaster.holdreason = holdreasons.reasoncode
INNER JOIN currencies
- debtorsmaster.currcode = currencies.currabrev
+ ON debtorsmaster.currcode = currencies.currabrev
WHERE debtorsmaster.debtorno = '" . $CustomerID . "'";
$ErrMsg =_('The customer details could not be retrieved by the SQL because');
Modified: trunk/FixedAssetItems.php
===================================================================
--- trunk/FixedAssetItems.php 2011-07-17 03:31:55 UTC (rev 4634)
+++ trunk/FixedAssetItems.php 2011-07-19 09:35:25 UTC (rev 4635)
@@ -123,28 +123,35 @@
$result = DB_Txn_Begin($db);
/*Need to check if changing the balance sheet codes - as will need to do journals for the cost and accum depn of the asset to the new category */
- $result = DB_query("SELECT assetcategoryid, cost, accumdepn, costact, accumdepnact FROM fixedassets INNER JOIN fixedassetcategories WHERE assetid='" . $AssetID . "'",$db);
+ $result = DB_query("SELECT assetcategoryid,
+ cost,
+ accumdepn,
+ costact,
+ accumdepnact
+ FROM fixedassets INNER JOIN fixedassetcategories
+ ON fixedassets.assetcategoryid=fixedassetcategories.categoryid
+ WHERE assetid='" . $AssetID . "'",$db);
$OldDetails = DB_fetch_array($result);
if ($OldDetails['assetcategoryid'] !=$_POST['AssetCategoryID'] AND $OldDetails['cost']!=0){
$PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db);
/* Get the new account codes for the new asset category */
$result = DB_query("SELECT costact,
- accumdepnact
- FROM fixedassetcategories
- WHERE categoryid='" . $_POST['AssetCategoryID'] . "'",$db);
+ accumdepnact
+ FROM fixedassetcategories
+ WHERE categoryid='" . $_POST['AssetCategoryID'] . "'",$db);
$NewAccounts = DB_fetch_array($result);
$TransNo = GetNextTransNo( 42, $db); /* transaction type is asset category change */
//credit cost for the old category
$SQL = "INSERT INTO gltrans (type,
- typeno,
- trandate,
- periodno,
- account,
- narrative,
- amount)
+ typeno,
+ trandate,
+ periodno,
+ account,
+ narrative,
+ amount)
VALUES ('42',
'" . $TransNo . "',
'" . Date('Y-m-d') . "',
@@ -159,12 +166,12 @@
//debit cost for the new category
$SQL = "INSERT INTO gltrans (type,
- typeno,
- trandate,
- periodno,
- account,
- narrative,
- amount)
+ typeno,
+ trandate,
+ periodno,
+ account,
+ narrative,
+ amount)
VALUES ('42',
'" . $TransNo . "',
'" . Date('Y-m-d') . "',
@@ -179,12 +186,12 @@
if ($OldDetails['accumdepn']!=0) {
//debit accumdepn for the old category
$SQL = "INSERT INTO gltrans (type,
- typeno,
- trandate,
- periodno,
- account,
- narrative,
- amount)
+ typeno,
+ trandate,
+ periodno,
+ account,
+ narrative,
+ amount)
VALUES ('42',
'" . $TransNo . "',
'" . Date('Y-m-d') . "',
@@ -199,12 +206,12 @@
//credit accum depn for the new category
$SQL = "INSERT INTO gltrans (type,
- typeno,
- trandate,
- periodno,
- account,
- narrative,
- amount)
+ typeno,
+ trandate,
+ periodno,
+ account,
+ narrative,
+ amount)
VALUES ('42',
'" . $TransNo . "',
'" . Date('Y-m-d') . "',
@@ -237,13 +244,13 @@
echo '<br />';
} else { //it is a NEW part
$sql = "INSERT INTO fixedassets (description,
- longdescription,
- assetcategoryid,
- assetlocation,
- depntype,
- depnrate,
- barcode,
- serialno)
+ longdescription,
+ assetcategoryid,
+ assetlocation,
+ depntype,
+ depnrate,
+ barcode,
+ serialno)
VALUES (
'" . $_POST['Description'] . "',
'" . $_POST['LongDescription'] . "',
@@ -278,12 +285,12 @@
$CancelDelete = 0;
//what validation is required before allowing deletion of assets .... maybe there should be no deletion option?
$result = DB_query("SELECT cost,
- accumdepn,
- accumdepnact,
- costact
- FROM fixedassets INNER JOIN fixedassetcategories
- ON fixedassets.assetcategoryid=fixedassetcategories.categoryid
- WHERE assetid='" . $AssetID . "'", $db);
+ accumdepn,
+ accumdepnact,
+ costact
+ FROM fixedassets INNER JOIN fixedassetcategories
+ ON fixedassets.assetcategoryid=fixedassetcategories.categoryid
+ WHERE assetid='" . $AssetID . "'", $db);
$AssetRow = DB_fetch_array($result);
$NBV = $AssetRow['cost'] -$AssetRow['accumdepn'];
if ($NBV!=0) {
@@ -309,12 +316,12 @@
if ($AssetRow['cost'] > 0){
//credit cost for the asset deleted
$SQL = "INSERT INTO gltrans (type,
- typeno,
- trandate,
- periodno,
- account,
- narrative,
- amount)
+ typeno,
+ trandate,
+ periodno,
+ account,
+ narrative,
+ amount)
VALUES ('43',
'" . $TransNo . "',
'" . Date('Y-m-d') . "',
@@ -329,12 +336,12 @@
//debit accumdepn for the depreciation removed on deletion of this asset
$SQL = "INSERT INTO gltrans (type,
- typeno,
- trandate,
- periodno,
- account,
- narrative,
- amount)
+ typeno,
+ trandate,
+ periodno,
+ account,
+ narrative,
+ amount)
VALUES ('43',
'" . $TransNo . "',
'" . Date('Y-m-d') . "',
@@ -394,19 +401,19 @@
} elseif ($InputError!=1) { // Must be modifying an existing item and no changes made yet - need to lookup the details
$sql = "SELECT assetid,
- description,
- longdescription,
- assetcategoryid,
- serialno,
- assetlocation,
- datepurchased,
- depntype,
- depnrate,
- cost,
- accumdepn,
- barcode
- FROM fixedassets
- WHERE assetid ='" . $AssetID . "'";
+ description,
+ longdescription,
+ assetcategoryid,
+ serialno,
+ assetlocation,
+ datepurchased,
+ depntype,
+ depnrate,
+ cost,
+ accumdepn,
+ barcode
+ FROM fixedassets
+ WHERE assetid ='" . $AssetID . "'";
$result = DB_query($sql, $db);
$AssetRow = DB_fetch_array($result);
@@ -441,14 +448,14 @@
} else {
$LongDescription ='';
}
-echo '<tr><td>' . _('Asset Description') . ' (' . _('long') . '):</td><td><textarea ' . (in_array('LongDescription',$Errors) ? 'class="texterror"' : '' ) .' name="LongDescription" cols=40 rows=4>' . stripslashes($LongDescription) . '</textarea></td></tr>'."\n";
+echo '<tr><td>' . _('Asset Description') . ' (' . _('long') . '):</td><td><textarea ' . (in_array('LongDescription',$Errors) ? 'class="texterror"' : '' ) .' name="LongDescription" cols=40 rows=4>' . stripslashes($LongDescription) . '</textarea></td></tr>';
if (!isset($New) ) { //ie not new at all!
echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td>';
if (function_exists('imagecreatefromjpg')){
- $StockImgLink = '<img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'.
+ $AssetImgLink = '<img src="GetStockImage.php?automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'.
'&AssetID='.urlencode($AssetID).
'&text='.
'&width=64'.
@@ -473,16 +480,16 @@
echo '<tr><td>' . _('Asset Category') . ':</td><td><select name="AssetCategoryID">';
-$sql = 'SELECT categoryid, categorydescription FROM fixedassetcategories';
+$sql = "SELECT categoryid, categorydescription FROM fixedassetcategories";
$ErrMsg = _('The asset categories could not be retrieved because');
$DbgMsg = _('The SQL used to retrieve stock categories and failed was');
$result = DB_query($sql,$db,$ErrMsg,$DbgMsg);
while ($myrow=DB_fetch_array($result)){
if (!isset($_POST['AssetCategoryID']) or $myrow['categoryid']==$_POST['AssetCategoryID']){
- echo '<option selected VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
+ echo '<option selected value="'. $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
} else {
- echo '<option VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']. '</option>';
+ echo '<option value="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']. '</option>';
}
$category=$myrow['categoryid'];
}
@@ -495,7 +502,7 @@
echo '<tr><td>' . _('Date Purchased') . ':</td><td>' . ConvertSQLDate($AssetRow['datepurchased']) . '</td></tr>';
}
-$sql = 'SELECT locationid, locationdescription FROM fixedassetlocations';
+$sql = "SELECT locationid, locationdescription FROM fixedassetlocations";
$ErrMsg = _('The asset locations could not be retrieved because');
$DbgMsg = _('The SQL used to retrieve asset locations and failed was');
$result = DB_query($sql,$db,$ErrMsg,$DbgMsg);
@@ -536,17 +543,17 @@
/*Get the last period depreciation (depn is transtype =44) was posted for */
echo '<table><tr><th colspan=2>' . _('Asset Financial Summary') . '</th></tr>';
-echo '<tr><td>' . _('Accumulated Costs') . ':</td><td class="number">' . number_format($AssetRow['cost'],2) . '</td></tr>';
-echo '<tr><td>' . _('Accumulated Depreciation') . ':</td><td class="number">' . number_format($AssetRow['accumdepn'],2) . '</td></tr>';
-echo '<tr><td>' . _('Net Book Value') . ':</td><td class="number">' . number_format($AssetRow['cost']-$AssetRow['accumdepn'],2) . '</td></tr>';
+echo '<tr><td>' . _('Accumulated Costs') . ':</td><td class="number">' . number_format($AssetRow['cost'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>';
+echo '<tr><td>' . _('Accumulated Depreciation') . ':</td><td class="number">' . number_format($AssetRow['accumdepn'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>';
+echo '<tr><td>' . _('Net Book Value') . ':</td><td class="number">' . number_format($AssetRow['cost']-$AssetRow['accumdepn'],$_SESSION['CompanyRecord']['decimalplaces']) . '</td></tr>';
-$result = DB_query('SELECT periods.lastdate_in_period,
+$result = DB_query("SELECT periods.lastdate_in_period,
max(fixedassettrans.periodno)
FROM fixedassettrans INNER JOIN periods
ON fixedassettrans.periodno=periods.periodno
WHERE transtype=44
GROUP BY periods.lastdate_in_period
- ORDER BY periods.lastdate_in_period DESC',$db);
+ ORDER BY periods.lastdate_in_period DESC",$db);
$LastDepnRun = DB_fetch_row($result);
if(DB_num_rows($result)==0){
@@ -559,13 +566,13 @@
if (isset($New)) {
- echo '<div class=centre><br /><input type="Submit" name="submit" value="' . _('Insert New Fixed Asset') . '">';
+ echo '<div class="centre"><br /><input type="submit" name="submit" value="' . _('Insert New Fixed Asset') . '">';
} else {
- echo '<br /><div class=centre><input type="submit" name="submit" value="' . _('Update') . '"></div>';
+ echo '<br /><div class="centre"><input type="submit" name="submit" value="' . _('Update') . '"></div>';
prnMsg( _('Only click the Delete button if you are sure you wish to delete the asset. Only assets with a zero book value can be deleted'), 'warn', _('WARNING'));
- echo '<br /><div class=centre><input type="Submit" name="delete" value="' . _('Delete This Asset') . '" onclick="return confirm(\'' . _('Are You Sure? Only assets with a zero book value can be deleted.') . '\');"></div>';
+ echo '<br /><div class="centre"><input type="submit" name="delete" value="' . _('Delete This Asset') . '" onclick="return confirm(\'' . _('Are You Sure? Only assets with a zero book value can be deleted.') . '\');"></div>';
}
echo '</form></div>';
Modified: trunk/FixedAssetRegister.php
===================================================================
--- trunk/FixedAssetRegister.php 2011-07-17 03:31:55 UTC (rev 4634)
+++ trunk/FixedAssetRegister.php 2011-07-19 09:35:25 UTC (rev 4635)
@@ -73,10 +73,10 @@
} elseif (isset($_POST['csv'])) {
$csv_output = "'Asset ID','Description','Serial Number','Location','Date Acquired','Cost B/Fwd','Period Additions','Depn B/Fwd','Period Depreciation','Cost C/Fwd', 'Accum Depn C/Fwd','NBV','Disposal Value'\n";
} else {
- echo '<form name="RegisterForm" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '"><table class=selection>';
+ echo '<form name="RegisterForm" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '"><table class="selection">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<div class="centre">' ._('From') . ':' . $_POST['FromDate'] . ' ' . _('to') . ' ' . $_POST['ToDate'] . '</div>';
- echo '<br /><table width=80% cellspacing="1" class=selection><tr>';
+ echo '<br /><table width=80% cellspacing="1" class="selection"><tr>';
echo '<th>' . _('Asset ID') . '</th>';
echo '<th>' . _('Description') . '</th>';
echo '<th>' . _('Serial Number') . '</th>';
@@ -196,13 +196,13 @@
if (isset($_POST['pdf'])) {
$LeftOvers = $pdf->addTextWrap($XPos, $YPos, 300 - $Left_Margin, $FontSize, _('TOTAL'));
- $LeftOvers = $pdf->addTextWrap($XPos + 270, $YPos, 70, $FontSize, number_format($TotalCostBfwd, 0), 'right');
- $LeftOvers = $pdf->addTextWrap($XPos + 340, $YPos, 70, $FontSize, number_format($TotalDepnBfwd, 0), 'right');
- $LeftOvers = $pdf->addTextWrap($XPos + 410, $YPos, 70, $FontSize, number_format($TotalAdditions, 0), 'right');
- $LeftOvers = $pdf->addTextWrap($XPos + 480, $YPos, 70, $FontSize, number_format($TotalDepn, 0), 'right');
- $LeftOvers = $pdf->addTextWrap($XPos + 550, $YPos, 70, $FontSize, number_format($TotalCostCfwd, 0), 'right');
- $LeftOvers = $pdf->addTextWrap($XPos + 620, $YPos, 70, $FontSize, number_format($TotalDepnCfwd, 0), 'right');
- $LeftOvers = $pdf->addTextWrap($XPos + 690, $YPos, 70, $FontSize, number_format($TotalNBV, 0), 'right');
+ $LeftOvers = $pdf->addTextWrap($XPos + 270, $YPos, 70, $FontSize, number_format($TotalCostBfwd, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
+ $LeftOvers = $pdf->addTextWrap($XPos + 340, $YPos, 70, $FontSize, number_format($TotalDepnBfwd, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
+ $LeftOvers = $pdf->addTextWrap($XPos + 410, $YPos, 70, $FontSize, number_format($TotalAdditions, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
+ $LeftOvers = $pdf->addTextWrap($XPos + 480, $YPos, 70, $FontSize, number_format($TotalDepn, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
+ $LeftOvers = $pdf->addTextWrap($XPos + 550, $YPos, 70, $FontSize, number_format($TotalCostCfwd, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
+ $LeftOvers = $pdf->addTextWrap($XPos + 620, $YPos, 70, $FontSize, number_format($TotalDepnCfwd, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
+ $LeftOvers = $pdf->addTextWrap($XPos + 690, $YPos, 70, $FontSize, number_format($TotalNBV, $_SESSION['CompanyRecord']['decimalplaces']), 'right');
$pdf->Output($_SESSION['DatabaseName'] . '_Asset Register_' . date('Y-m-d') . '.pdf', 'I');
exit;
@@ -213,11 +213,11 @@
header('Location: ' .$_SESSION['reports_dir'] . '/FixedAssetRegister_' . Date('Y-m-d') .'.csv');
} else {
- echo '<input type=hidden name=FromDate value="' . $_POST['FromDate'] . '">';
- echo '<input type=hidden name=ToDate value=' . $_POST['ToDate'] . '>';
- echo '<input type=hidden name=AssetCategory value=' . $_POST['AssetCategory'] . '>';
- echo '<input type=hidden name=AssetID value=' . $_POST['AssetID'] . '>';
- echo '<input type=hidden name=AssetLocation value=' . $_POST['AssetLocation'] . '>';
+ echo '<input type=hidden name="FromDate" value="' . $_POST['FromDate'] . '">';
+ echo '<input type=hidden name="ToDate" value=' . $_POST['ToDate'] . '>';
+ echo '<input type=hidden name="AssetCategory" value=' . $_POST['AssetCategory'] . '>';
+ echo '<input type=hidden name="AssetID" value=' . $_POST['AssetID'] . '>';
+ echo '<input type=hidden name="AssetLocation" value=' . $_POST['AssetLocation'] . '>';
//Total Values
echo '<tr><th style="vertical-align:top" colspan="5">' . _('TOTAL') . '</th>';
echo '<th style="text-align:right">' . number_format($TotalCostBfwd, $_SESSION['CompanyRecord']['decimalplaces']) . '</th>';
@@ -253,7 +253,7 @@
$sql = "SELECT locationid, locationdescription FROM fixedassetlocations";
$result = DB_query($sql, $db);
echo '<tr><th>' . _('Asset Location') . '</th>';
- echo '<td><select name=AssetLocation>';
+ echo '<td><select name="AssetLocation">';
echo '<option value="%">' . _('ALL') . '</option>';
while ($myrow = DB_fetch_array($result)) {
if (isset($_POST['AssetLocation']) AND $myrow['locationid'] == $_POST['AssetLocation']) {
@@ -290,7 +290,7 @@
</table>
<br />';
- echo '<div class="centre"><input type="Submit" name="submit" value="' . _('Show Assets') . '"> ';
+ echo '<div class="centre"><input type="submit" name="submit" value="' . _('Show Assets') . '"> ';
echo '<input type="Submit" name="pdf" value="' . _('Print as a pdf') . '"> ';
echo '<input type="Submit" name = "csv" value= "' . _('Print as CSV') . '"></div>';
echo '</form>';
Modified: trunk/FixedAssetTransfer.php
===================================================================
--- trunk/FixedAssetTransfer.php 2011-07-17 03:31:55 UTC (rev 4634)
+++ trunk/FixedAssetTransfer.php 2011-07-19 09:35:25 UTC (rev 4635)
@@ -24,25 +24,25 @@
} else if (isset($_POST['AssetID'])) {
$AssetID=$_POST['AssetID'];
} else {
- $sql='SELECT categoryid, categorydescription FROM fixedassetcategories';
+ $sql="SELECT categoryid, categorydescription FROM fixedassetcategories";
$result=DB_query($sql, $db);
echo '<form action="'. $_SERVER['PHP_SELF'] . '" method=post>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') .
'" alt="" />' . ' ' . $title . '</p>';
- echo '<table class=selection><tr>';
+ echo '<table class="selection"><tr>';
echo '<td>'. _('In Asset Category') . ': ';
echo '<select name="AssetCat">';
if (!isset($_POST['AssetCat'])) {
- $_POST['AssetCat'] = "";
+ $_POST['AssetCat'] = '';
}
while ($myrow = DB_fetch_array($result)) {
if ($myrow['categoryid'] == $_POST['AssetCat']) {
- echo '<option selected VALUE="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'];
+ echo '<option selected value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
} else {
- echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'];
+ echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categorydescription'] . '</option>';
}
}
@@ -88,14 +88,14 @@
}
$sql= "SELECT fixedassets.assetid,
- fixedassets.cost,
- fixedassets.accumdepn,
- fixedassets.description,
- fixedassets.depntype,
- fixedassets.serialno,
- fixedassets.barcode,
- fixedassets.assetlocation,
- fixedassetlocations.locationdescription
+ fixedassets.cost,
+ fixedassets.accumdepn,
+ fixedassets.description,
+ fixedassets.depntype,
+ fixedassets.serialno,
+ fixedassets.barcode,
+ fixedassets.assetlocation,
+ fixedassetlocations.locationdescription
FROM fixedassets
INNER JOIN fixedassetlocations
ON fixedassets.assetlocation=fixedassetlocations.locationid
@@ -115,7 +115,7 @@
<th>' . _('Move To :') . '</th>
</tr>';
- $locationsql='SELECT locationid, locationdescription from fixedassetlocations';
+ $locationsql="SELECT locationid, locationdescription from fixedassetlocations";
$LocationResult=DB_query($locationsql, $db);
while ($myrow=DB_fetch_array($Result)) {
@@ -123,8 +123,8 @@
echo '<tr><td>'.$myrow['assetid'].'</td>
<td>'.$myrow['description'].'</td>
<td>'.$myrow['serialno'].'</td>
- <td class=number>'.number_format($myrow['cost'],2).'</td>
- <td class=number>'.number_format($myrow['accumdepn'],2).'</td>
+ <td class="number">'.number_format($myrow['cost'],$_SESSION['CompanyRecord']['decimalplaces']).'</td>
+ <td class="number">'.number_format($myrow['accumdepn'],$_SESSION['CompanyRecord']['decimalplaces']).'</td>
<td>'.$myrow['locationdescription'].'</td>';
echo '<td><select name="Location'.$myrow['assetid'].'" onChange="ReloadForm(Move'.$myrow['assetid'].')">';
echo '<option></option>';
@@ -141,7 +141,7 @@
echo '<input type="hidden" name="Keywords" value="' . $_POST['Keywords'].'"';
echo '<input type="hidden" name="AssetID" value="' . $_POST['AssetID'].'"';
echo '<input type="hidden" name="Search" value="' . $_POST['Search'].'"';
- echo '<td><input type="submit" name="Move'.$myrow['assetid'].'" value=Move></td>';
+ echo '<td><input type="submit" name="Move'.$myrow['assetid'].'" value="Move"></td>';
echo '</tr>';
}
echo '</table></form>';
Modified: trunk/InventoryPlanning.php
===================================================================
--- trunk/InventoryPlanning.php 2011-07-17 03:31:55 UTC (rev 4634)
+++ trunk/InventoryPlanning.php 2011-07-19 09:35:25 UTC (rev 4635)
@@ -2,7 +2,6 @@
/* $Id$ */
-//$PageSecurity = 2;
include('includes/session.inc');
if (isset($_POST['PrintPDF'])
@@ -53,26 +52,26 @@
need QOH, QOO, QDem, Sales Mth -1, Sales Mth -2, Sales Mth -3, Sales Mth -4*/
if ($_POST['Location']=='All'){
$SQL = "SELECT stockmaster.categoryid,
- stockmaster.description,
- stockcategory.categorydescription,
- locstock.stockid,
- SUM(locstock.quantity) AS qoh
- FROM locstock,
- stockmaster,
- stockcategory
- WHERE locstock.stockid=stockmaster.stockid
- AND stockmaster.discontinued = 0
- AND stockmaster.categoryid=stockcategory.categoryid
- AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M')
- AND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "'
- AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "'
- GROUP BY stockmaster.categoryid,
- stockmaster.description,
- stockcategory.categorydescription,
- locstock.stockid,
- stockmaster.stockid
- ORDER BY stockmaster.categoryid,
- stockmaster.stockid";
+ stockmaster.description,
+ stockcategory.categorydescription,
+ locstock.stockid,
+ SUM(locstock.quantity) AS qoh
+ FROM locstock,
+ stockmaster,
+ stockcategory
+ WHERE locstock.stockid=stockmaster.stockid
+ AND stockmaster.discontinued = 0
+ AND stockmaster.categoryid=stockcategory.categoryid
+ AND (stockmaster.mbflag='B' OR stockmaster.mbflag='M')
+ AND stockmaster.categoryid >= '" . $_POST['FromCriteria'] . "'
+ AND stockmaster.categoryid <= '" . $_POST['ToCriteria'] . "'
+ GROUP BY stockmaster.categoryid,
+ stockmaster.description,
+ stockcategory.categorydescription,
+ locstock.stockid,
+ stockmaster.stockid
+ ORDER BY stockmaster.categoryid,
+ stockmaster.stockid";
} else {
$SQL = "SELECT stockmaster.categoryid,
locstock.stockid,
@@ -99,9 +98,9 @@
$title = _('Inventory Planning') . ' - ' . _('Problem Report') . '....';
include('includes/header.inc');
prnMsg(_('The inventory quantities could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db),'error');
- 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";
+ echo '<br />'.$SQL;
}
include('includes/footer.inc');
exit;
@@ -145,27 +144,27 @@
if ($_POST['Location']=='All'){
$SQL = "SELECT SUM(CASE WHEN prd='" . $CurrentPeriod . "' THEN -qty ELSE 0 END) AS prd0,
- SUM(CASE WHEN prd='" . $Period_1 . "' THEN -qty ELSE 0 END) AS prd1,
- SUM(CASE WHEN prd='" . $Period_2 . "' THEN -qty ELSE 0 END) AS prd2,
- SUM(CASE WHEN prd='" . $Period_3 . "' THEN -qty ELSE 0 END) AS prd3,
- SUM(CASE WHEN prd='" . $Period_4 . "' THEN -qty ELSE 0 END) AS prd4,
- SUM(CASE WHEN prd='" . $Period_5 . "' THEN -qty ELSE 0 END) AS prd5
- FROM stockmoves
- WHERE stockid='" . $InventoryPlan['stockid'] . "'
- AND (type=10 OR type=11)
- AND stockmoves.hidemovt=0";
+ SUM(CASE WHEN prd='" . $Period_1 . "' THEN -qty ELSE 0 END) AS prd1,
+ SUM(CASE WHEN prd='" . $Period_2 . "' THEN -qty ELSE 0 END) AS prd2,
+ SUM(CASE WHEN prd='" . $Period_3 . "' THEN -qty ELSE 0 END) AS prd3,
+ SUM(CASE WHEN prd='" . $Period_4 . "' THEN -qty ELSE 0 END) AS prd4,
+ SUM(CASE WHEN prd='" . $Period_5 . "' THEN -qty ELSE 0 END) AS prd5
+ FROM stockmoves
+ WHERE stockid='" . $InventoryPlan['stockid'] . "'
+ AND (type=10 OR type=11)
+ AND stockmoves.hidemovt=0";
} else {
$SQL = "SELECT SUM(CASE WHEN prd='" . $CurrentPeriod . "' THEN -qty ELSE 0 END) AS prd0,
- SUM(CASE WHEN prd='" . $Period_1 . "' THEN -qty ELSE 0 END) AS prd1,
- SUM(CASE WHEN prd='" . $Period_2 . "' THEN -qty ELSE 0 END) AS prd2,
- SUM(CASE WHEN prd='" . $Period_3 . "' THEN -qty ELSE 0 END) AS prd3,
- SUM(CASE WHEN prd='" . $Period_4 . "' THEN -qty ELSE 0 END) AS prd4,
- SUM(CASE WHEN prd='" . $Period_5 . "' THEN -qty ELSE 0 END) AS prd5
- FROM stockmoves
- WHERE stockid='" . $InventoryPlan['stockid'] . "'
- AND stockmoves.loccode ='" . $_POST['Location'] . "'
- AND (stockmoves.type=10 OR stockmoves.type=11)
- AND stockmoves.hidemovt=0";
+ SUM(CASE WHEN prd='" . $Period_1 . "' THEN -qty ELSE 0 END) AS prd1,
+ SUM(CASE WHEN prd='" . $Period_2 . "' THEN -qty ELSE 0 END) AS prd2,
+ SUM(CASE WHEN prd='" . $Period_3 . "' THEN -qty ELSE 0 END) AS prd3,
+ SUM(CASE WHEN prd='" . $Period_4 . "' THEN -qty ELSE 0 END) AS prd4,
+ SUM(CASE WHEN prd='" . $Period_5 . "' THEN -qty ELSE 0 END) AS prd5
+ FROM stockmoves
+ WHERE stockid='" . $InventoryPlan['stockid'] . "'
+ AND stockmoves.loccode ='" . $_POST['Location'] . "'
+ AND (stockmoves.type=10 OR stockmoves.type=11)
+ AND stockmoves.hidemovt=0";
}
$SalesResult = DB_query($SQL,$db,'','', false, false);
@@ -174,9 +173,9 @@
$title = _('Inventory Planning') . ' - ' . _('Problem Report') . '....';
include('includes/header.inc');
prnMsg( _('The sales quantities could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db),'error');
- 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";
+ echo '<br />' .$SQL;
}
include('includes/footer.inc');
@@ -209,9 +208,9 @@
$title = _('Inventory Planning') . ' - ' . _('Problem Report') . '....';
include('includes/header.inc');
prnMsg( _('The sales order demand quantities could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db),'error');
- 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";
+ echo '<br />'.$SQL;
}
include('includes/footer.inc');
exit;
@@ -257,9 +256,9 @@
$title = _('Inventory Planning') . ' - ' . _('Problem Report') . '....';
include('includes/header.inc');
prnMsg( _('The sales order demand quantities from parent assemblies could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db),'error');
- 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";
+ echo '<br />'.$SQL;
}
include('includes/footer.inc');
exit;
@@ -267,23 +266,23 @@
if ($_POST['Location']=='All'){
$SQL = "SELECT SUM(purchorderdetails.quantityord - purchorderdetails.quantityrecd) as qtyonorder
- FROM purchorderdetails INNER JOIN purchorders
- ON purchorderdetails.orderno = purchorders.orderno
- WHERE purchorderdetails.itemcode = '" . $InventoryPlan['stockid'] . "'
- AND purchorderdetails.completed = 0
- AND purchorders.status <> 'Cancelled'
- AND purchorders.status <> 'Rejected'
- AND purchorders.status <> 'Pending'";
+ FROM purchorderdetails INNER JOIN purchorders
+ ON purchorderdetails.orderno = purchorders.orderno
+ WHERE purchorderdetails.itemcode = '" . $InventoryPlan['stockid'] . "'
+ AND purchorderdetails.completed = 0
+ AND purchorders.status <> 'Cancelled'
+ AND purchorders.status <> 'Rejected'
+ AND purchorders.status <> 'Pending'";
} else {
$SQL = "SELECT SUM(purchorderdetails.quantityord - purchorderdetails.quantityrecd) as qtyonorder
- FROM purchorderdetails INNER JOIN purchorders
- ON purchorderdetails.orderno = purchorders.orderno
- WHERE purchorderdetails.itemcode = '" . $InventoryPlan['stockid'] . "'
- AND purchorderdetails.completed = 0
- AND purchorders.intostoc...
[truncated message content] |