From: <dai...@us...> - 2010-11-21 09:20:15
|
Revision: 4163 http://web-erp.svn.sourceforge.net/web-erp/?rev=4163&view=rev Author: daintree Date: 2010-11-21 09:20:08 +0000 (Sun, 21 Nov 2010) Log Message: ----------- Fixed assets and coding standards Modified Paths: -------------- trunk/GoodsReceived.php trunk/PO_Items.php trunk/SelectOrderItems.php trunk/includes/DefinePOClass.php trunk/includes/PO_ReadInOrder.inc trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2010-11-21 03:28:30 UTC (rev 4162) +++ trunk/GoodsReceived.php 2010-11-21 09:20:08 UTC (rev 4163) @@ -334,7 +334,7 @@ unset($_SESSION['PO']->LineItems); unset($_SESSION['PO']); unset($_POST['ProcessGoodsReceived']); - include ("includes/footer.inc"); + include ('includes/footer.inc'); exit; } $LineNo++; @@ -654,8 +654,8 @@ $StatusComment=$date.' - Order Completed'.'<br>'.$comment; $sql="UPDATE purchorders SET status='" . PurchOrder::STATUS_COMPLITED . "', - stat_comment='".$StatusComment."' - WHERE orderno='".$_SESSION['PO']->OrderNo . "'"; + stat_comment='" . $StatusComment . "' + WHERE orderno='" . $_SESSION['PO']->OrderNo . "'"; $result=DB_query($sql,$db); } @@ -676,7 +676,7 @@ } else { /*Process Goods received not set so show a link to allow mod of line items on order and allow input of date goods received*/ - echo '<br><div class='centre'><a href="' . $rootpath . '/PO_Items.php?=' . SID . '">' . _('Modify Order Items'). '</a></div>'; + echo '<br><div class="centre"><a href="' . $rootpath . '/PO_Items.php?=' . SID . '">' . _('Modify Order Items'). '</a></div>'; echo '<br><div class="centre"><input type=submit name=Update Value=' . _('Update') . '><p>'; echo '<input type=submit name="ProcessGoodsReceived" Value="' . _('Process Goods Received') . '"></div>'; Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2010-11-21 03:28:30 UTC (rev 4162) +++ trunk/PO_Items.php 2010-11-21 09:20:08 UTC (rev 4163) @@ -639,8 +639,8 @@ if ($_SESSION['PO'.$identifier]->GLLink==1){ $sql = "SELECT accountname - FROM chartmaster - WHERE accountcode ='" . (int) $_POST['GLCode'] . "'"; + FROM chartmaster + WHERE accountcode ='" . (int) $_POST['GLCode'] . "'"; $ErrMsg = _('The account details for') . ' ' . $_POST['GLCode'] . ' ' . _('could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the details of the account, but failed was'); $GLValidResult = DB_query($sql,$db,$ErrMsg,$DbgMsg,false,false); @@ -664,6 +664,17 @@ else { $_POST['GLCode']=0; } + if (strlen($_POST['AssetID'])>0){ + if (!is_numeric($_POST['AssetID'])){ + $AllowUpdate = false; + prnMsg(_('An asset code was entered but it is not numeric. A numeric asset code that exists must be entered when ordering a fixed asset'),'error'); + } + $ValidAssetResult = DB_query('SELECT assetid FROM fixedassets WHERE assetid="' . $_POST['AssetID'] . '"',$db); + if (DB_num_rows($ValidAssetResult)==0){ // then the asset id entered doesn't exist + $AllowUpdate = false; + prnMsg(_('An asset code was entered but it does not yet exist. Only pre-existing asset ids can be entered when ordering a fixed asset'),'error'); + } + } //end if an AssetID is entered if (strlen($_POST['ItemDescription'])<=3){ $AllowUpdate = false; prnMsg(_('Cannot enter this order line') . ':<br>' . _('The description of the item being purchase is required where a non-stock item is being ordered'),'warn'); @@ -698,8 +709,7 @@ $_POST['gw'], $_POST['cuft'], $_POST['total_quantity'], - $_POST['total_amount'] - ); + $_POST['total_amount'] ); include ('includes/PO_UnsetFormVbls.php'); } } @@ -925,7 +935,7 @@ echo '<tr class="OddTableRows">'; $k=1; } - $uomsql="SELECT conversionfactor, + $UomSQL="SELECT conversionfactor, suppliersuom, unitsofmeasure. unitname @@ -935,27 +945,27 @@ WHERE supplierno='".$_SESSION['PO'.$identifier]->SupplierID."' AND stockid='".$POLine->StockID."'"; - $uomresult=DB_query($uomsql, $db); - if (DB_num_rows($uomresult)>0) { - $uomrow=DB_fetch_array($uomresult); - if (strlen($uomrow['suppliersuom'])>0) { - $uom=$uomrow['unitname']; + $UomResult=DB_query($UomSQL, $db); + if (DB_num_rows($UomResult)>0) { + $UomRow=DB_fetch_array($UomResult); + if (strlen($UomRow['suppliersuom'])>0) { + $Uom=$UomRow['unitname']; } else { - $uom=$POLine->Units; + $Uom=$POLine->Units; } } else { - $uom=$POLine->Units; + $Uom=$POLine->Units; } // echo "<td>$POLine->StockID</td><td>$POLine->ItemDescription</td>td> class=number>$DisplayQuantity</td><td>$POLine->Units</td><td>$POLine->ReqDelDate</td>td> class=number>$DisplayPrice</td>td> class=number>$DisplayLineTotal</font></td><td><a href='" . $_SERVER['PHP_SELF'] . "?" . SID . "&Edit=" . $POLine->LineNo . "'>" . _('Select') . "</a></td></tr>"; - echo "<td>".$POLine->StockID ."</td> - <td>".$POLine->ItemDescription."</td> - <td><input type=text class=number name=Qty".$POLine->LineNo ." size=11 value=".$DisplayQuantity."></td> - <td>".$uom."</td> - <td><input type=text class=number name=nw".$POLine->LineNo." size=11 value=".$POLine->nw."></td> - <td><input type=text class=number name=Price".$POLine->LineNo." size=11 value=".$DisplayPrice."></td> - <td class=number>".$DisplayLineTotal."</td> - <td><input type=text class=date alt='".$_SESSION['DefaultDateFormat']."' name=ReqDelDate".$POLine->LineNo." size=11 value=".$POLine->ReqDelDate."></td> - <td><a href='" . $_SERVER['PHP_SELF'] . "?" . SID . "identifier=".$identifier. "&Delete=" . $POLine->LineNo . "'>" . _('Delete') . "</a></td></tr>"; + echo '<td>' . $POLine->StockID . '</td> + <td>' . $POLine->ItemDescription . '</td> + <td><input type="text" class="number" name="Qty' . $POLine->LineNo .'" size="11" value="' . $DisplayQuantity . '"></td> + <td>' . $Uom . '</td> + <td><input type="text" class="number" name="nw' . $POLine->LineNo . '" size="11" value="' . $POLine->nw . '"></td> + <td><input type="text" class="number" name="Price' . $POLine->LineNo . '" size="11" value="' .$DisplayPrice.'"></td> + <td class="number">' . $DisplayLineTotal . '</td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="11" value="' .$POLine->ReqDelDate .'"></td> + <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $POLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; $_SESSION['PO'.$identifier]->total = $_SESSION['PO'.$identifier]->total + $LineTotal; } } @@ -967,7 +977,6 @@ if (!isset($_POST['NewItem']) and isset($_GET['Edit'])) { /*show a form for putting in a new line item with or without a stock entry */ - } } /*Only display the order line items if there are any !! */ @@ -977,23 +986,25 @@ echo '<td><input type=text name=ItemDescription size=40></td></tr>'; echo '<tr><td>'._('General Ledger Code').'</td>'; echo '<td><select name="GLCode">'; - $sql="SELECT - accountcode, - accountname - FROM chartmaster - ORDER BY accountcode ASC"; + $sql='SELECT accountcode, + accountname + FROM chartmaster + ORDER BY accountcode ASC'; + $result=DB_query($sql, $db); while ($myrow=DB_fetch_array($result)) { echo '<option value="'.$myrow['accountcode'].'">'.$myrow['accountcode'].' - '.$myrow['accountname'].'</option>'; } echo '</td></tr>'; - echo '<tr><td>'._('Quantity to purchase').'</td>'; - echo '<td><input type=text class=number name=Qty size=10></td></tr>'; - echo '<tr><td>'._('Price per item').'</td>'; - echo '<td><input type=text class=number name=Price size=10></td></tr>'; - echo '<tr><td>'._('Delivery Date').'</td>'; - echo '<td><input type=text class=date alt="'.$_SESSION['DefaultDateFormat'].'" name=ReqDelDate size=11 - value="'.$_SESSION['PO'.$identifier]->deliverydate .'"></td></tr>'; + echo '<tr><td>'._('OR Asset ID'). '</td> + <td><input type="text" class="number" name="AssetID" size="10" maxlength=12> + <a href="FixedAssetItems.php" target=_blank>'. _('New Fixed Asset') . '</a></td> + <tr><td>'._('Quantity to purchase').'</td> + <td><input type="text" class="number" name="Qty" size=10></td></tr> + <tr><td>'._('Price per item').'</td> + <td><input type="text" class="number" name="Price" size=10></td></tr> + <tr><td>'._('Delivery Date').'</td> + <td><input type="text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ReqDelDate" size=11 value="'.$_SESSION['PO'.$identifier]->deliverydate .'"></td></tr>'; echo '</table>'; echo '<div class=centre><input type=submit name="EnterLine" value="Enter Item"></div>'; } @@ -1001,26 +1012,26 @@ /* Now show the stock item selection search stuff below */ if (!isset($_GET['Edit'])) { - $sql="SELECT categoryid, - categorydescription - FROM stockcategory - WHERE stocktype<>'L' - AND stocktype<>'D' - ORDER BY categorydescription"; + $sql='SELECT categoryid, + categorydescription + FROM stockcategory + WHERE stocktype<>"L" + AND stocktype<>"D" + ORDER BY categorydescription'; $ErrMsg = _('The supplier category details could not be retrieved because'); $DbgMsg = _('The SQL used to retrieve the category details but failed was'); $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); echo '<table class=selection><tr><th colspan=3><font size=3 color=blue>'. _('Search For Stock Items') . '</th>'; - echo ":</font></tr><tr><td><select name='StockCat'>"; + echo ':</font></tr><tr><td><select name="StockCat">'; - echo "<option selected value='All'>" . _('All'); + echo '<option selected value="All">' . _('All'); while ($myrow1 = DB_fetch_array($result1)) { if (isset($_POST['StockCat']) and $_POST['StockCat']==$myrow1['categoryid']){ - echo "<option selected value=". $myrow1['categoryid'] . '>' . $myrow1['categorydescription']; + echo '<option selected value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } else { - echo "<option value=". $myrow1['categoryid'] . '>' . $myrow1['categorydescription']; + echo '<option value="'. $myrow1['categoryid'] . '">' . $myrow1['categorydescription'] . '</option>'; } } @@ -1059,13 +1070,13 @@ echo "<table cellpadding=1 colspan=7 class=selection>"; - $tableheader = "<tr> - <th>" . _('Code') . "</th> - <th>" . _('Description') . "</th> - <th>" . _('Units') . "</th> - <th colspan=2><a href='#end'>"._('Go to end of list')."</a></th> - </tr>"; - echo $tableheader; + $TableHeader = '<tr> + <th>' . _('Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Units') . '</th> + <th colspan=2><a href="#end">'._('Go to end of list').'</a></th> + </tr>'; + echo $TableHeader; $j = 1; $k=0; //row colour counter @@ -1090,32 +1101,32 @@ $ImageSource = '<i>'._('No Image').'</i>'; } - $uomsql="SELECT conversionfactor, - suppliersuom, - unitsofmeasure.unitname - FROM purchdata - LEFT JOIN unitsofmeasure - ON purchdata.suppliersuom=unitsofmeasure.unitid - WHERE supplierno='".$_SESSION['PO'.$identifier]->SupplierID."' - AND stockid='".$myrow['stockid']."'"; + $UomSQL="SELECT conversionfactor, + suppliersuom, + unitsofmeasure.unitname + FROM purchdata + LEFT JOIN unitsofmeasure + ON purchdata.suppliersuom=unitsofmeasure.unitid + WHERE supplierno='".$_SESSION['PO'.$identifier]->SupplierID."' + AND stockid='".$myrow['stockid']."'"; - $uomresult=DB_query($uomsql, $db); - if (DB_num_rows($uomresult)>0) { - $uomrow=DB_fetch_array($uomresult); - if (strlen($uomrow['suppliersuom'])>0) { - $uom=$uomrow['unitname']; + $UomResult=DB_query($UomSQL, $db); + if (DB_num_rows($UomResult)>0) { + $UomRow=DB_fetch_array($UomResult); + if (strlen($UomRow['suppliersuom'])>0) { + $Uom=$UomRow['unitname']; } else { - $uom=$myrow['units']; + $Uom=$myrow['units']; } } else { - $uom=$myrow['units']; + $Uom=$myrow['units']; } echo "<td>".$myrow['stockid']."</td> <td>".$myrow['description']."</td> - <td>".$uom."</td> + <td>".$Uom."</td> <td>".$ImageSource."</td> <td><input class='number' type='text' size=6 value=0 name='qty".$myrow['stockid']."'></td> - <input type='hidden' size=6 value=".$uom." name=uom> + <input type='hidden' size=6 value=".$Uom." name=uom> </tr>"; $PartsDisplayed++; Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2010-11-21 03:28:30 UTC (rev 4162) +++ trunk/SelectOrderItems.php 2010-11-21 09:20:08 UTC (rev 4163) @@ -1112,7 +1112,7 @@ } /*end of if its a new item */ - if (isset($NewItem_array) && isset($_POST['order_items'])){ + if (isset($NewItem_array) AND isset($_POST['order_items'])){ /* get the item details from the database and hold them in the cart object make the quantity 1 by default then add it to the cart */ /*Now figure out if the item is a kit set - the field MBFlag='K'*/ foreach($NewItem_array as $NewItem => $NewItemQty) { @@ -1302,11 +1302,11 @@ $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,2); if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ - $ColSpanNumber = 7; + $ColSpanNumber = 3; } else { - $ColSpanNumber = 5; + $ColSpanNumber = 1; } - echo '<tr class="EvenTableRows"><td></td><td><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> + echo '<tr class="EvenTableRows"><td class="number" colspan=7><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> <td colspan="' . $ColSpanNumber . '" class=number>' . $DisplayTotal . '</td></tr></table>'; $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2010-11-21 03:28:30 UTC (rev 4162) +++ trunk/includes/DefinePOClass.php 2010-11-21 09:20:08 UTC (rev 4163) @@ -85,49 +85,51 @@ $itemno, $uom, $ConversionFactor=1, - $leadtime=1, - $suppliers_partno='', - $subtotal_amount=0, - $package=0, - $pcunit=0, + $LeadTime=1, + $Suppliers_PartNo='', + $SubTotal_Amount=0, + $Package=0, + $PcUnit=0, $nw=0, $gw=0, - $cuft=0, - $total_quantity=0, - $total_amount=0){ + $CuFt=0, + $Total_Quantity=0, + $Total_Amount=0, + $AssetID=''){ if ($Qty!=0 && isset($Qty)){ $this->LineItems[$LineNo] = new LineDetails($LineNo, - $StockID, - $Serialised, - $Controlled, - $Qty, - $ItemDescr, - $Price, - $UOM, - $GLCode, - $ReqDelDate, - $ShiptRef, - 0, - $JobRef, - $QtyInv, - $QtyRecd, - $GLActName, - $DecimalPlaces, - $itemno, - $uom, - $ConversionFactor, - $leadtime, - $suppliers_partno, - $subtotal_amount, - $package, - $pcunit, - $nw, - $gw, - $cuft, - $total_quantity, - $total_amount); + $StockID, + $Serialised, + $Controlled, + $Qty, + $ItemDescr, + $Price, + $UOM, + $GLCode, + $ReqDelDate, + $ShiptRef, + 0, + $JobRef, + $QtyInv, + $QtyRecd, + $GLActName, + $DecimalPlaces, + $itemno, + $uom, + $ConversionFactor, + $LeadTime, + $Suppliers_PartNo, + $SubTotal_Amount, + $Package, + $PcUnit, + $nw, + $gw, + $CuFt, + $Total_Quantity, + $Total_Amount, + $AssetID); $this->LinesOnOrder++; Return 1; } @@ -135,26 +137,26 @@ } function update_order_item($LineNo, - $Qty, - $Price, - $ItemDescription, - $GLCode, - $GLAccountName, - $ReqDelDate, - $ShiptRef, - $JobRef , - $itemno, - $uom, - $ConversionFactor, - $suppliers_partno, - $subtotal_amount, - $package, - $pcunit, - $nw, - $gw, - $cuft, - $total_quantity, - $total_amount){ + $Qty, + $Price, + $ItemDescription, + $GLCode, + $GLAccountName, + $ReqDelDate, + $ShiptRef, + $JobRef , + $itemno, + $uom, + $ConversionFactor, + $Suppliers_PartNo, + $SubTotal_Amount, + $Package, + $PcUnit, + $nw, + $gw, + $CuFt, + $Total_Quantity, + $Total_Amount){ $this->LineItems[$LineNo]->ItemDescription = $ItemDescription; $this->LineItems[$LineNo]->Quantity = $Qty; @@ -164,18 +166,18 @@ $this->LineItems[$LineNo]->ReqDelDate = $ReqDelDate; $this->LineItems[$LineNo]->ShiptRef = $ShiptRef; $this->LineItems[$LineNo]->JobRef = $JobRef; - $this->LineItems[$LineNo]->itemno = $itemno; + $this->LineItems[$LineNo]->ItemNo = $ItemNo; $this->LineItems[$LineNo]->uom = $uom; $this->LineItems[$LineNo]->ConversionFactor = $ConversionFactor; - $this->LineItems[$LineNo]->suppliers_partno = $suppliers_partno; - $this->LineItems[$LineNo]->subtotal_amount = $subtotal_amount; - $this->LineItems[$LineNo]->package = $package; - $this->LineItems[$LineNo]->pcunit = $pcunit; + $this->LineItems[$LineNo]->Suppliers_PartNo = $Suppliers_PartNo; + $this->LineItems[$LineNo]->Subtotal_Amount = $SubTotal_Amount; + $this->LineItems[$LineNo]->Package = $Package; + $this->LineItems[$LineNo]->PcUnit = $PcUnit; $this->LineItems[$LineNo]->nw = $nw; $this->LineItems[$LineNo]->gw = $gw; - $this->LineItems[$LineNo]->cuft = $cuft; - $this->LineItems[$LineNo]->total_quantity = $total_quantity; - $this->LineItems[$LineNo]->total_amount = $total_amount; + $this->LineItems[$LineNo]->CuFt = $CuFt; + $this->LineItems[$LineNo]->Total_Quantity = $Total_Quantity; + $this->LineItems[$LineNo]->Total_Amount = $Total_Amount; $this->LineItems[$LineNo]->Price = $Price; } @@ -188,7 +190,7 @@ /* Checks if there have been deliveries or invoiced entered against any of the line items */ if (count($this->LineItems)>0){ foreach ($this->LineItems as $OrderedItems) { - if ($OrderedItems->QtyReceived !=0 || $OrderedItems->QtyInvoiced !=0){ + if ($OrderedItems->QtyReceived !=0 OR $OrderedItems->QtyInvoiced !=0){ return 1; } } @@ -234,57 +236,57 @@ var $ShiptRef; var $completed; Var $JobRef; - Var $itemno; + Var $ItemNo; Var $uom; var $ConversionFactor; - Var $suppliers_partno; - Var $subtotal_amount; - Var $leadtime; - Var $package; - Var $pcunit; + Var $Suppliers_PartNo; + Var $SubTotal_Amount; + Var $LeadTime; + Var $Package; + Var $PcUnit; Var $nw; Var $gw; - Var $cuft; - Var $total_quantity; - Var $total_amount; + Var $CuFt; + Var $Total_Quantity; + Var $Total_Amount; Var $ReceiveQty; Var $Deleted; Var $Controlled; Var $Serialised; Var $SerialItems; /*An array holding the batch/serial numbers and quantities in each batch*/ + Var $AssetID; - function LineDetails ( - $LineNo, - $StockItem, - $Serialised, - $Controlled, - $Qty, - $ItemDescr, - $Prc, - $UOM, - $GLCode, - $ReqDelDate, - $ShiptRef =0, - $Completed, - $JobRef, - $QtyInv, - $QtyRecd, - $GLActName, - $DecimalPlaces, - $itemno, - $uom, - $ConversionFactor, - $suppliers_partno, - $subtotal_amount, - $leadtime, - $package, - $pcunit, - $nw, - $gw, - $cuft, - $total_quantity, - $total_amount) - { + function LineDetails ( $LineNo, + $StockItem, + $Serialised, + $Controlled, + $Qty, + $ItemDescr, + $Prc, + $UOM, + $GLCode, + $ReqDelDate, + $ShiptRef =0, + $Completed, + $JobRef, + $QtyInv, + $QtyRecd, + $GLActName, + $DecimalPlaces, + $ItemNo, + $uom, + $ConversionFactor, + $Suppliers_PartNo, + $SubTotal_Amount, + $LeadTime, + $Package, + $PcUnit, + $nw, + $gw, + $CuFt, + $Total_Quantity, + $Total_Amount, + $AssetID) { /* Constructor function to add a new LineDetail object with passed params */ $this->LineNo = $LineNo; @@ -301,18 +303,18 @@ $this->QtyInv = $QtyInv; $this->GLCode = $GLCode; $this->JobRef = $JobRef; - $this->itemno = $itemno; + $this->ItemNo = $itemno; $this->uom = $uom; $this->ConversionFactor = $ConversionFactor; - $this->suppliers_partno = $suppliers_partno; - $this->subtotal_amount = $subtotal_amount; - $this->leadtime = $leadtime; - $this->pcunit = $pcunit; + $this->Suppliers_PartNo = $Suppliers_PartNo; + $this->Subtotal_Amount = $SubTotal_Amount; + $this->LeadTime = $LeadTime; + $this->PcUnit = $PcUnit; $this->nw = $nw; $this->gw = $gw; - $this->cuft = $cuft; - $this->total_quantity = $total_quantity; - $this->total_amount = $total_amount; + $this->CuFt = $CuFt; + $this->Total_Quantity = $Total_Quantity; + $this->Total_Amount = $Total_Amount; if (is_numeric($ShiptRef)){ $this->ShiptRef = $ShiptRef; } else { @@ -325,6 +327,7 @@ $this->Deleted=False; $this->SerialItems = array(); /*if Controlled then need to populate this later */ $this->SerialItemsValid=false; + $this->AssetID= $AssetID; } } Modified: trunk/includes/PO_ReadInOrder.inc =================================================================== --- trunk/includes/PO_ReadInOrder.inc 2010-11-21 03:28:30 UTC (rev 4162) +++ trunk/includes/PO_ReadInOrder.inc 2010-11-21 09:20:08 UTC (rev 4163) @@ -100,17 +100,17 @@ $_SESSION['PO'.$identifier]->paymentterms= $myrow['paymentterms']; $supplierSQL = "SELECT suppliers.supplierid, - suppliers.suppname, - suppliers.address1, - suppliers.address2, - suppliers.address3, - suppliers.address4, - suppliers.address5, - suppliers.address6, - suppliers.currcode - FROM suppliers - WHERE suppliers.supplierid='" . $_SESSION['PO'.$identifier]->SupplierID."' - ORDER BY suppliers.supplierid"; + suppliers.suppname, + suppliers.address1, + suppliers.address2, + suppliers.address3, + suppliers.address4, + suppliers.address5, + suppliers.address6, + suppliers.currcode + FROM suppliers + WHERE suppliers.supplierid='" . $_SESSION['PO'.$identifier]->SupplierID."' + ORDER BY suppliers.supplierid"; $ErrMsg = _('The searched supplier records requested cannot be retrieved because'); $result_SuppSelect = DB_query($supplierSQL,$db,$ErrMsg); @@ -126,43 +126,44 @@ /*now populate the line PO array with the purchase order details records */ $LineItemsSQL = "SELECT podetailitem, - itemcode, - stockmaster.description, - purchorderdetails.deliverydate, - itemdescription, - glcode, - accountname, - qtyinvoiced, - unitprice, - units, - quantityord, - quantityrecd, - shiptref, - completed, - jobref, - stdcostunit, - itemno, - stockmaster.controlled, - stockmaster.serialised, - stockmaster.decimalplaces, - subtotal_amount, - package, - pcunit, - nw, - gw, - cuft, - total_quantity, - total_amount - FROM purchorderdetails - LEFT JOIN stockmaster - ON purchorderdetails.itemcode=stockmaster.stockid - LEFT JOIN purchorders - ON purchorders.orderno=purchorderdetails.orderno - LEFT JOIN chartmaster - ON purchorderdetails.glcode=chartmaster.accountcode - WHERE purchorderdetails.completed=0 - AND purchorderdetails.orderno =" . $_GET['ModifyOrderNumber'] . ' - ORDER BY podetailitem'; + itemcode, + stockmaster.description, + purchorderdetails.deliverydate, + itemdescription, + glcode, + accountname, + qtyinvoiced, + unitprice, + units, + quantityord, + quantityrecd, + shiptref, + completed, + jobref, + stdcostunit, + itemno, + stockmaster.controlled, + stockmaster.serialised, + stockmaster.decimalplaces, + subtotal_amount, + package, + pcunit, + nw, + gw, + cuft, + total_quantity, + total_amount, + assetid + FROM purchorderdetails + LEFT JOIN stockmaster + ON purchorderdetails.itemcode=stockmaster.stockid + LEFT JOIN purchorders + ON purchorders.orderno=purchorderdetails.orderno + LEFT JOIN chartmaster + ON purchorderdetails.glcode=chartmaster.accountcode + WHERE purchorderdetails.completed=0 + AND purchorderdetails.orderno ='" . $_GET['ModifyOrderNumber'] . "' + ORDER BY podetailitem"; $ErrMsg = _('The lines on the purchase order cannot be retrieved because'); $DbgMsg = _('The SQL statement that was used to retrieve the purchase order lines was'); @@ -187,63 +188,63 @@ } else { $StockID = $myrow['itemcode']; } - $datesql='SELECT max(effectivefrom) - FROM purchdata - WHERE supplierno="'.$_SESSION['PO'.$identifier]->SupplierID.'" - AND stockid="'.$StockID.'" - AND effectivefrom<="'.$_SESSION['PO'.$identifier]->Orig_OrderDate.'"'; - $dateresult=DB_query($datesql, $db); - $date=DB_fetch_row($dateresult); - if ($date[0]!='') { + $DateSQL='SELECT max(effectivefrom) + FROM purchdata + WHERE supplierno="'.$_SESSION['PO'.$identifier]->SupplierID.'" + AND stockid="'.$StockID.'" + AND effectivefrom<="'.$_SESSION['PO'.$identifier]->Orig_OrderDate.'"'; + $DateResult=DB_query($DateSQL, $db); + $Date=DB_fetch_row($DateResult); + if ($Date[0]!='') { $sql='SELECT unitsofmeasure.unitname, - suppliers_partno, - conversionfactor - FROM purchdata - LEFT JOIN unitsofmeasure - ON purchdata.suppliersuom=unitsofmeasure.unitid - WHERE supplierno="'.$_SESSION['PO'.$identifier]->SupplierID.'" - AND stockid="'.$StockID.'" - AND effectivefrom="'.$date[0].'"'; - $purchdataresult=DB_query($sql, $db); - $myrow2=DB_fetch_array($purchdataresult); + suppliers_partno, + conversionfactor + FROM purchdata + LEFT JOIN unitsofmeasure + ON purchdata.suppliersuom=unitsofmeasure.unitid + WHERE supplierno="'.$_SESSION['PO'.$identifier]->SupplierID.'" + AND stockid="'.$StockID.'" + AND effectivefrom="'.$Date[0].'"'; + $PurchDataResult=DB_query($sql, $db); + $myrow2=DB_fetch_array($PurchDataResult); } else { $sql='SELECT units as unitname, stockid as suppliers_partno FROM stockmaster WHERE stockid="'.$StockID.'"'; - $purchdataresult=DB_query($sql, $db); - $myrow2=DB_fetch_array($purchdataresult); + $PurchDataResult=DB_query($sql, $db); + $myrow2=DB_fetch_array($PurchDataResult); $myrow2['conversionfactor']=1; } $_SESSION['PO'.$identifier]->add_to_order($_SESSION['PO'.$identifier]->LinesOnOrder+1, - $StockID, - $myrow['serialised'], - $myrow['controlled'], - $myrow['quantityord'], - stripslashes($myrow['itemdescription']), - $myrow['unitprice'], - $Units, - $GLCode, - ConvertSQLDate($myrow['deliverydate']), - $myrow['shiptref'], - $myrow['completed'], - $myrow['jobref'], - $myrow['qtyinvoiced'], - $myrow['quantityrecd'], - $myrow['accountname'], - $myrow['decimalplaces'], - $myrow['itemno'], - $myrow2['unitname'], - $myrow2['conversionfactor'], - $myrow2['suppliers_partno'], - $myrow['subtotal_amount'], - 0, - $myrow['package'], - $myrow['pcunit'], - $myrow['nw'], - $myrow['gw'], - $myrow['cuft'], - $myrow['total_quantity'], - $myrow['total_amount']); - + $StockID, + $myrow['serialised'], + $myrow['controlled'], + $myrow['quantityord'], + stripslashes($myrow['itemdescription']), + $myrow['unitprice'], + $Units, + $GLCode, + ConvertSQLDate($myrow['deliverydate']), + $myrow['shiptref'], + $myrow['completed'], + $myrow['jobref'], + $myrow['qtyinvoiced'], + $myrow['quantityrecd'], + $myrow['accountname'], + $myrow['decimalplaces'], + $myrow['itemno'], + $myrow2['unitname'], + $myrow2['conversionfactor'], + $myrow2['suppliers_partno'], + $myrow['subtotal_amount'], + 0, + $myrow['package'], + $myrow['pcunit'], + $myrow['nw'], + $myrow['gw'], + $myrow['cuft'], + $myrow['total_quantity'], + $myrow['total_amount']); + $_SESSION['PO'.$identifier]->LineItems[$_SESSION['PO'.$identifier]->LinesOnOrder]->PODetailRec = $myrow['podetailitem']; $_SESSION['PO'.$identifier]->LineItems[$_SESSION['PO'.$identifier]->LinesOnOrder]->StandardCost = $myrow['stdcostunit']; /*Needed for receiving goods and GL interface */ } /* line PO from purchase order details */ Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-11-21 03:28:30 UTC (rev 4162) +++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2010-11-21 09:20:08 UTC (rev 4163) @@ -444,8 +444,9 @@ ALTER TABLE fixedassets ADD COLUMN `longdescription` text NOT NULL; ALTER TABLE fixedassets ADD COLUMN `depntype` int NOT NULL DEFAULT 1; ALTER TABLE fixedassets ADD COLUMN `depnrate` double NOT NULL; -ALTER TABLE `fixedassets` CHANGE `depn` `accumdepn` DOUBLE NOT NULL DEFAULT '0' -ALTER TABLE `fixedassets` CHANGE `location` `assetlocation` VARCHAR( 6 ) NOT NULL DEFAULT '' +ALTER TABLE fixedassets ADD COLUMN `barcode` VARCHAR( 30 ) NOT NULL; +ALTER TABLE `fixedassets` CHANGE `depn` `accumdepn` DOUBLE NOT NULL DEFAULT '0'; +ALTER TABLE `fixedassets` CHANGE `location` `assetlocation` VARCHAR( 6 ) NOT NULL DEFAULT ''; UPDATE fixedassets INNER JOIN stockmaster ON fixedassets.stockid=stockmaster.stockid SET assetcategoryid=stockmaster.categoryid, fixedassets.description=stockmaster.description, fixedassets.longdescription=stockmaster.longdescription; @@ -491,5 +492,4 @@ INDEX ( inputdate ) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; - UPDATE config SET confvalue='4.0-RC2' WHERE confname='VersionName'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |