From: <tim...@us...> - 2010-04-07 19:34:49
|
Revision: 3414 http://web-erp.svn.sourceforge.net/web-erp/?rev=3414&view=rev Author: tim_schofield Date: 2010-04-07 19:34:30 +0000 (Wed, 07 Apr 2010) Log Message: ----------- SelectOrdderitems.php and DeliveryDetails.php - Improvements to layout. Modified Paths: -------------- trunk/DeliveryDetails.php trunk/SelectOrderItems.php trunk/doc/Change.log.html Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2010-04-07 19:31:29 UTC (rev 3413) +++ trunk/DeliveryDetails.php 2010-04-07 19:34:30 UTC (rev 3414) @@ -127,7 +127,7 @@ $_POST['ShipVia'] = $BestShipper; } else { prnMsg(_($_POST['FreightCost']),'warn'); - } + } } $sql = 'SELECT custbranch.brname, custbranch.braddress1, @@ -324,9 +324,9 @@ $ConfDate = FormatDateforSQL($_SESSION['Items'.$identifier]->ConfirmedDate); $Result = DB_Txn_Begin($db); - + $OrderNo = GetNextTransNo(30, $db); - + $HeaderSQL = 'INSERT INTO salesorders ( orderno, debtorno, @@ -382,7 +382,7 @@ $ErrMsg = _('The order cannot be added because'); $InsertQryResult = DB_query($HeaderSQL,$db,$ErrMsg); - + $StartOf_LineItemsSQL = 'INSERT INTO salesorderdetails ( orderlineno, orderno, @@ -410,22 +410,22 @@ )'; $ErrMsg = _('Unable to add the sales order line'); $Ins_LineItemResult = DB_query($LineItemsSQL,$db,$ErrMsg,$DbgMsg,true); - - /*Now check to see if the item is manufactured - * and AutoCreateWOs is on + + /*Now check to see if the item is manufactured + * and AutoCreateWOs is on * and it is a real order (not just a quotation)*/ - - if ($StockItem->MBflag=='M' - AND $_SESSION['AutoCreateWOs']==1 - AND $_SESSION['Items'.$identifier]->Quotation!=1){ //oh yeah its all on! - + + if ($StockItem->MBflag=='M' + AND $_SESSION['AutoCreateWOs']==1 + AND $_SESSION['Items'.$identifier]->Quotation!=1){ //oh yeah its all on! + echo '<br>'; - + //now get the data required to test to see if we need to make a new WO $QOHResult = DB_query("SELECT SUM(quantity) FROM locstock WHERE stockid='" . $StockItem->StockID . "'",$db); $QOHRow = DB_fetch_row($QOHResult); $QOH = $QOHRow[0]; - + $SQL = "SELECT SUM(salesorderdetails.quantity - salesorderdetails.qtyinvoiced) AS qtydemand FROM salesorderdetails WHERE salesorderdetails.stkcode = '" . $StockItem->StockID . "' @@ -433,7 +433,7 @@ $DemandResult = DB_query($SQL,$db); $DemandRow = DB_fetch_row($DemandResult); $QuantityDemand = $DemandRow[0]; - + $SQL = "SELECT SUM((salesorderdetails.quantity-salesorderdetails.qtyinvoiced)*bom.quantity) AS dem FROM salesorderdetails, bom, @@ -447,7 +447,7 @@ $AssemblyDemandResult = DB_query($SQL,$db); $AssemblyDemandRow = DB_fetch_row($AssemblyDemandResult); $QuantityAssemblyDemand = $AssemblyDemandRow[0]; - + $SQL = "SELECT SUM(purchorderdetails.quantityord - purchorderdetails.quantityrecd) as qtyonorder FROM purchorderdetails, purchorders @@ -457,7 +457,7 @@ $PurchOrdersResult = DB_query($SQL,$db); $PurchOrdersRow = DB_fetch_row($PurchOrdersResult); $QuantityPurchOrders = $PurchOrdersRow[0]; - + $SQL = "SELECT SUM(woitems.qtyreqd - woitems.qtyrecd) as qtyonorder FROM woitems INNER JOIN workorders ON woitems.wo=workorders.wo @@ -470,7 +470,7 @@ //Now we have the data - do we need to make any more? $ShortfallQuantity = $QOH-$QuantityDemand-$QuantityAssemblyDemand+$QuantityPurchOrders+$QuantityWorkOrders; - + if ($ShortfallQuantity < 0) { //then we need to make a work order //How many should the work order be for?? if ($ShortfallQuantity + $StockItem->EOQ < 0){ @@ -478,7 +478,7 @@ } else { $WOQuantity = $StockItem->EOQ; } - + $WONo = GetNextTransNo(40,$db); $ErrMsg = _('Unable to insert a new work order for the sales order item'); $InsWOResult = DB_query("INSERT INTO workorders (wo, @@ -504,7 +504,7 @@ } else { $Cost = $CostRow[0]; } - + // insert parent item info $sql = "INSERT INTO woitems (wo, stockid, @@ -520,16 +520,16 @@ //Recursively insert real component requirements - see includes/SQL_CommonFunctions.in for function WoRealRequirements WoRealRequirements($db, $WONo, $_SESSION['DefaultFactoryLocation'], $StockItem->StockID); - $FactoryManagerEmail = _('A new work order has been created for') . + $FactoryManagerEmail = _('A new work order has been created for') . ":\n" . $StockItem->StockID . ' - ' . $StockItem->Descr . ' x ' . $WOQuantity . ' ' . $StockItem->UOM . "\n" . _('These are for') . ' ' . $_SESSION['Items'.$identifier]->CustomerName . ' ' . _('there order ref') . ': ' . $_SESSION['Items'.$identifier]->CustRef . ' ' ._('our order number') . ': ' . $OrderNo; - + if ($StockItem->Serialised AND $StockItem->NextSerialNo>0){ //then we must create the serial numbers for the new WO also $FactoryManagerEmail .= "\n" . _('The following serial numbers have been reserved for this work order') . ':'; - + for ($i=0;$i<$WOQuantity;$i++){ - + $result = DB_query("SELECT serialno FROM stockserialitems WHERE serialno='" . ($StockItem->NextSerialNo + $i) . "' AND stockid='" . $StockItem->StockID ."'",$db); @@ -540,14 +540,14 @@ $sql = 'INSERT INTO woserialnos (wo, stockid, serialno) - VALUES (' . $WONo . ", + VALUES (' . $WONo . ", '" . $StockItem->StockID . "', " . ($StockItem->NextSerialNo + $i) . ')'; $ErrMsg = _('The serial number for the work order item could not be added'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); $FactoryManagerEmail .= "\n" . ($StockItem->NextSerialNo + $i); } - } //end loop around creation of woserialnos + } //end loop around creation of woserialnos $NewNextSerialNo = ($StockItem->NextSerialNo + $WOQuantity +1); $ErrMsg = _('Could not update the new next serial number for the item'); $UpdateNextSerialNoResult = DB_query('UPDATE stockmaster SET nextserialno=' . $NewNextSerialNo . " WHERE stockid='" . $StockItem->StockID . "'",$db,$ErrMsg,$DbgMsg,true); @@ -555,12 +555,12 @@ $EmailSubject = _('New Work Order Number') . ' ' . $WONo . ' ' . _('for') . ' ' . $StockItem->StockID . ' x ' . $WOQuantity; //Send email to the Factory Manager - mail($_SESSION['FactoryManagerEmail'],$EmailSubject,$FactoryManagerEmail); + mail($_SESSION['FactoryManagerEmail'],$EmailSubject,$FactoryManagerEmail); } //end if with this sales order there is a shortfall of stock - need to create the WO }//end if auto create WOs in on } /* end inserted line items into sales order details */ - $result = DB_Txn_Commit($db); + $result = DB_Txn_Commit($db); echo '<br>'; if ($_SESSION['Items'.$identifier]->Quotation==1){ prnMsg(_('Quotation Number') . ' ' . $OrderNo . ' ' . _('has been entered'),'success'); @@ -702,7 +702,7 @@ echo _('Order Summary'); } echo '</b></div> - <table cellpading=2 colspan=7 border=1> + <table cellpading=2 colspan=7> <Tr> <th>'. _('Item Code') .'</th> <th>'. _('Item Description') .'</th> @@ -750,14 +750,14 @@ } $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,2); - echo '<tr> + echo '<tr class="EvenTableRows"> <td colspan=6 class=number><b>'. _('TOTAL Excl Tax/Freight') .'</b></td> <td class=number>'.$DisplayTotal.'</td> </tr></table>'; $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); - echo '<table border=1><tr> + echo '<br><table class=selection><tr> <td>'. _('Total Weight') .':</td> <td>'.$DisplayWeight.'</td> <td>'. _('Total Volume') .':</td> @@ -809,7 +809,7 @@ } $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,2); - echo '<table><tr> + echo '<table class=selection><tr> <td>'. _('Total Weight') .':</td> <td>'.$DisplayWeight .'</td> <td>'. _('Total Volume') .':</td> @@ -818,7 +818,7 @@ $DisplayVolume = number_format($_SESSION['Items'.$identifier]->totalVolume,2); $DisplayWeight = number_format($_SESSION['Items'.$identifier]->totalWeight,2); - echo '<table border=1><tr> + echo '<table class=selection><tr> <td>'. _('Total Weight') .':</td> <td>'. $DisplayWeight .'</td> <td>'. _('Total Volume') .':</td> @@ -827,7 +827,7 @@ } -echo '<br><table><tr> +echo '<br><table class=selection><tr> <td>'. _('Deliver To') .':</td> <td><input type=text size=42 maxlength=40 name="DeliverTo" value="' . $_SESSION['Items'.$identifier]->DeliverTo . '"></td> </tr>'; Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2010-04-07 19:31:29 UTC (rev 3413) +++ trunk/SelectOrderItems.php 2010-04-07 19:34:30 UTC (rev 3414) @@ -386,8 +386,15 @@ // record returned from a search so parse the $Select string into customer code and branch code */ if (isset($_POST['Select']) AND $_POST['Select']!='') { - $_SESSION['Items'.$identifier]->Branch = substr($_POST['Select'],strpos($_POST['Select'],' - ')+3); + $branchsql='SELECT branchcode + FROM custbranch + WHERE brname="'.substr($_POST['Select'],strpos($_POST['Select'],' - ')+3).'" + AND debtorno="'.substr($_POST['Select'],0,strpos($_POST['Select'],' - ')).'"'; + $branchresult=DB_query($branchsql, $db); + $branchrow=DB_fetch_row($branchresult); + $_SESSION['Items'.$identifier]->Branch = $branchrow[0]; + $_POST['Select'] = substr($_POST['Select'],0,strpos($_POST['Select'],' - ')); // Now check to ensure this account is not on hold */ @@ -453,7 +460,7 @@ FROM custbranch INNER JOIN locations ON custbranch.defaultlocation=locations.loccode - WHERE custbranch.brname='" . $_SESSION['Items'.$identifier]->Branch . "' + WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' AND custbranch.debtorno = '" . $_POST['Select'] . "'"; $ErrMsg = _('The customer branch record of the customer selected') . ': ' . $_POST['Select'] . ' ' . _('cannot be retrieved because'); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2010-04-07 19:31:29 UTC (rev 3413) +++ trunk/doc/Change.log.html 2010-04-07 19:34:30 UTC (rev 3414) @@ -1,5 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>07/04/10 Tim: SelectOrdderitems.php and DeliveryDetails.php - Improvements to layout.</p> +<p>07/04/10 Tim: Improvements to the silverwolf theme.</p> <p>07/04/10 Tim: SelectOrderItems.php - Improve layout and correct for paging of items.</p> <p>07/04/10 Tim: PO_Items.php - Remove the Back To Purchase Order Header link if the order is already posted.</p> <p>07/04/10 Tim: SystemParameters.php and Currencies.php - Correct so that currency updates are only done when Automatic is chosen.</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |