From: <tim...@us...> - 2012-06-29 18:54:41
|
Revision: 5464 http://web-erp.svn.sourceforge.net/web-erp/?rev=5464&view=rev Author: tim_schofield Date: 2012-06-29 18:54:34 +0000 (Fri, 29 Jun 2012) Log Message: ----------- Give the option to print quotations in Landscape or Portrait Modified Paths: -------------- trunk/DeliveryDetails.php trunk/SelectSalesOrder.php Modified: trunk/DeliveryDetails.php =================================================================== --- trunk/DeliveryDetails.php 2012-06-28 19:21:46 UTC (rev 5463) +++ trunk/DeliveryDetails.php 2012-06-29 18:54:34 UTC (rev 5464) @@ -583,7 +583,7 @@ <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Invoice') . '" alt="" /></td> <td>' . ' ' . '<a href="' . $rootpath . '/ConfirmDispatch_Invoice.php?identifier='.$identifier . '&OrderNumber=' . $OrderNo .'">'. _('Confirm Dispatch and Produce Invoice') .'</a></td> </tr>'; - + echo '</table>'; } else { @@ -768,17 +768,23 @@ $Quotation = $_SESSION['Items'.$identifier]->Quotation; unset($_SESSION['Items'.$identifier]->LineItems); unset($_SESSION['Items'.$identifier]); - + if($Quotation){ //handle Quotations and Orders print after modification prnMsg(_('Quotation Number') .' ' . $_SESSION['ExistingOrder'.$identifier] . ' ' . _('has been updated'),'success'); - echo '<br /> - <table class="selection"> - <tr> - <td><img src="'.$rootpath.'/css/'.$theme.'/images/printer.png" title="' . _('Print') . '" alt="" /></td> - <td><a target="_blank" href="' .$rootpath.'/PDFQuotation.php?QuotationNo='.$_SESSION['ExistingOrder'.$identifier].'">'._('Print Quotation').'</a></td> - </tr> - </table>'; //end of print Quotation + /*link to print the quotation */ + echo '<br /><table class="selection"> + <tr> + <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt=""></td> + <td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotation.php?identifier='.$identifier . '&QuotationNo=' . $_SESSION['ExistingOrder'.$identifier] . '">'. _('Print Quotation (Landscape)') .'</a></td> + </tr> + </table>'; + echo '<br /><table class="selection"> + <tr> + <td><img src="'.$rootpath.'/css/'.$theme.'/images/reports.png" title="' . _('Order') . '" alt="" /></td> + <td>' . ' ' . '<a href="' . $rootpath . '/PDFQuotationPortrait.php?identifier='.$identifier . '&QuotationNo=' . $_SESSION['ExistingOrder'.$identifier] . '">'. _('Print Quotation (Portrait)') .'</a></td> + </tr> + </table>'; }else{ prnMsg(_('Order Number') .' ' . $_SESSION['ExistingOrder'.$identifier] . ' ' . _('has been updated'),'success'); @@ -824,9 +830,9 @@ /*Display the order with or without discount depending on access level*/ if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ - + echo '<table>'; - + if ($_SESSION['Items'.$identifier]->Quotation==1){ echo '<tr><th colspan="7">'._('Quotation Summary').'</th></tr>'; } else { @@ -1064,7 +1070,7 @@ echo '<tr><td>' . _('Packlist Type') . ':</td> <td><select name="DeliverBlind">'; - + if ($_SESSION['Items'.$identifier]->DeliverBlind ==2){ echo '<option value="1">' . _('Show Company Details/Logo') . '</option>'; echo '<option selected="selected" value="2">' . _('Hide Company Details/Logo') . '</option>'; Modified: trunk/SelectSalesOrder.php =================================================================== --- trunk/SelectSalesOrder.php 2012-06-28 19:21:46 UTC (rev 5463) +++ trunk/SelectSalesOrder.php 2012-06-29 18:54:34 UTC (rev 5464) @@ -58,16 +58,16 @@ stockcategory.stockact ORDER BY purchdata.supplierno, purchdata.stockid"; - + $ErrMsg = _('Unable to retrieve the items on the selected orders for creating purchase orders for'); $ItemResult = DB_query($sql,$db,$ErrMsg); - + $ItemArray = array(); - + while ($myrow = DB_fetch_array($ItemResult)){ $ItemArray[$myrow['stockid']] = $myrow; } - + /* Now figure out if there are any components of Assembly items that need to be ordered too */ $sql = "SELECT purchdata.supplierno, purchdata.stockid, @@ -81,21 +81,21 @@ stockmaster.volume, stockcategory.stockact, SUM(bom.quantity *(salesorderdetails.quantity-salesorderdetails.qtyinvoiced)) AS orderqty - FROM purchdata INNER JOIN bom + FROM purchdata INNER JOIN bom ON purchdata.stockid=bom.component INNER JOIN salesorderdetails ON bom.parent=salesorderdetails.stkcode INNER JOIN stockmaster ON purchdata.stockid = stockmaster.stockid - INNER JOIN stockmaster AS stockmaster2 + INNER JOIN stockmaster AS stockmaster2 ON stockmaster2.stockid=salesorderdetails.stkcode INNER JOIN stockcategory ON stockmaster.categoryid = stockcategory.categoryid - WHERE purchdata.preferred=1 + WHERE purchdata.preferred=1 AND stockmaster2.mbflag='A' AND bom.loccode ='" . $_SESSION['UserStockLocation'] . "' AND purchdata.effectivefrom <='" . Date('Y-m-d') . "' - AND bom.effectiveafter <='" . Date('Y-m-d') . "' + AND bom.effectiveafter <='" . Date('Y-m-d') . "' AND bom.effectiveto > '" . Date('Y-m-d') . "' AND (" . $OrdersToPlacePOFor . ") GROUP BY purchdata.supplierno, @@ -113,7 +113,7 @@ purchdata.stockid"; $ErrMsg = _('Unable to retrieve the items on the selected orders for creating purchase orders for'); $ItemResult = DB_query($sql,$db,$ErrMsg); - + /* add any assembly item components from salesorders to the ItemArray */ while ($myrow = DB_fetch_array($ItemResult)){ if (isset($ItemArray[$myrow['stockid']])){ @@ -129,9 +129,9 @@ */ foreach ($ItemArray as $key => $row) { //to make the Supplier array with the keys of the $ItemArray - $SupplierArray[$key] = $row['supplierno']; + $SupplierArray[$key] = $row['supplierno']; } - + /* Use array_multisort to Sort the ItemArray with supplierno ascending Add $ItemArray as the last parameter, to sort by the common key */ @@ -214,7 +214,7 @@ /*Starting a new purchase order with a different supplier */ $result = DB_Txn_Begin($db); - + $PO_OrderNo = GetNextTransNo(18, $db); //get the next PO number $SupplierID = $ItemRow['supplierno']; @@ -333,20 +333,20 @@ /* The last line to be purchase ordered was reach so there will be an order which is not yet completed in progress now to completed it */ - + if ($SupplierID !='' AND $_SESSION['AutoAuthorisePO']==1) { //if the user has authority to authorise the PO then it should be created as authorised $AuthSQL ="SELECT authlevel FROM purchorderauth WHERE userid='".$_SESSION['UserID']."' AND currabrev='".$SuppRow['currcode']."'"; - + $AuthResult=DB_query($AuthSQL,$db); $AuthRow=DB_fetch_array($AuthResult); if ($AuthRow['authlevel']=''){ $AuthRow['authlevel'] = 0; } - + if (DB_num_rows($AuthResult) > 0 AND $AuthRow['authlevel'] > $Order_Value) { //user has authority to authrorise as well as create the order $StatusComment = date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . ' - '._('Auto created from sales orders') .'<br />'; $ErrMsg = _('Could not update purchase order status to Authorised'); @@ -362,7 +362,7 @@ } else { $AuthMessage = _('You can only authorise up to').' '.$SuppRow['currcode'].' '.$AuthRow['authlevel'].'.<br />'; } - + prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '. $SuppRow['currcode'] . ' '. $Order_Value .'. '. $AuthMessage . _('If you think this is a mistake please contact the systems administrator') . '<br />'. _('The order has been created with a status of pending and will require authorisation'), 'warn'); } } //end of authorisation status settings @@ -573,7 +573,7 @@ </div> <br />'; -if (isset($StockItemsResult) +if (isset($StockItemsResult) AND DB_num_rows($StockItemsResult)>0) { echo '<table cellpadding="2" class="selection">'; @@ -632,7 +632,7 @@ if(!isset($_POST['StockLocation'])) { $_POST['StockLocation'] = ''; } - if (isset($_REQUEST['OrderNumber']) + if (isset($_REQUEST['OrderNumber']) AND $_REQUEST['OrderNumber'] !='') { $SQL = "SELECT salesorders.orderno, debtorsmaster.name, @@ -644,11 +644,11 @@ salesorders.printedpackingslip, salesorders.poplaced, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)/currencies.rate) AS ordervalue - FROM salesorders INNER JOIN salesorderdetails + FROM salesorders INNER JOIN salesorderdetails ON salesorders.orderno = salesorderdetails.orderno - INNER JOIN debtorsmaster + INNER JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno - INNER JOIN custbranch + INNER JOIN custbranch ON debtorsmaster.debtorno = custbranch.debtorno AND salesorders.branchcode = custbranch.branchcode INNER JOIN currencies @@ -682,11 +682,11 @@ salesorders.printedpackingslip, salesorders.poplaced, salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)/currencies.rate AS ordervalue - FROM salesorders INNER JOIN salesorderdetails + FROM salesorders INNER JOIN salesorderdetails ON salesorders.orderno = salesorderdetails.orderno - INNER JOIN debtorsmaster + INNER JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno - INNER JOIN custbranch + INNER JOIN custbranch ON debtorsmaster.debtorno = custbranch.debtorno AND salesorders.branchcode = custbranch.branchcode INNER JOIN currencies @@ -710,11 +710,11 @@ salesorders.poplaced, salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)/currencies.rate) AS ordervalue - FROM salesorders INNER JOIN salesorderdetails + FROM salesorders INNER JOIN salesorderdetails ON salesorders.orderno = salesorderdetails.orderno - INNER JOIN debtorsmaster + INNER JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno - INNER JOIN custbranch + INNER JOIN custbranch ON debtorsmaster.debtorno = custbranch.debtorno AND salesorders.branchcode = custbranch.branchcode INNER JOIN currencies @@ -747,11 +747,11 @@ salesorders.poplaced, salesorders.deliverydate, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)/currencies.rate) AS ordervalue - FROM salesorders INNER JOIN salesorderdetails + FROM salesorders INNER JOIN salesorderdetails ON salesorders.orderno = salesorderdetails.orderno - INNER JOIN debtorsmaster + INNER JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno - INNER JOIN custbranch + INNER JOIN custbranch ON debtorsmaster.debtorno = custbranch.debtorno AND salesorders.branchcode = custbranch.branchcode INNER JOIN currencies @@ -781,11 +781,11 @@ salesorders.printedpackingslip, salesorders.poplaced, SUM(salesorderdetails.unitprice*salesorderdetails.quantity*(1-salesorderdetails.discountpercent)/currencies.rate) AS ordervalue - FROM salesorders INNER JOIN salesorderdetails + FROM salesorders INNER JOIN salesorderdetails ON salesorders.orderno = salesorderdetails.orderno - INNER JOIN debtorsmaster + INNER JOIN debtorsmaster ON salesorders.debtorno = debtorsmaster.debtorno - INNER JOIN custbranch + INNER JOIN custbranch ON debtorsmaster.debtorno = custbranch.debtorno AND salesorders.branchcode = custbranch.branchcode INNER JOIN currencies @@ -813,12 +813,12 @@ /*show a table of the orders returned by the SQL */ if (DB_num_rows($SalesOrdersResult)>0) { - + /* Get users authority to place POs */ $AuthSQL="SELECT cancreate FROM purchorderauth WHERE userid='". $_SESSION['UserID'] . "'"; - + /*we don't know what currency these orders might be in but if no authority at all then don't show option*/ $AuthResult=DB_query($AuthSQL,$db); $AuthRow=DB_fetch_array($AuthResult); @@ -837,7 +837,7 @@ <th>' . _('Req Del Date') . '</th> <th>' . _('Delivery To') . '</th> <th>' . _('Order Total') . '<br />' . $_SESSION['CompanyRecord']['currencydefault'] . '</th>'; - + if ($AuthRow['cancreate']==0){ //If cancreate==0 then this means the user can create orders hmmm!! $tableheader .= '<th>' . _('Place PO') . '</th></tr>'; } else { @@ -863,7 +863,7 @@ $j = 1; $k=0; //row colour counter $OrdersTotal =0; - + while ($myrow=DB_fetch_array($SalesOrdersResult)) { @@ -877,25 +877,26 @@ $ModifyPage = $rootpath . '/SelectOrderItems.php?ModifyOrderNumber=' . $myrow['orderno']; $Confirm_Invoice = $rootpath . '/ConfirmDispatch_Invoice.php?OrderNumber=' .$myrow['orderno']; - + if ($_SESSION['PackNoteFormat']==1){ /*Laser printed A4 default */ $PrintDispatchNote = $rootpath . '/PrintCustOrder_generic.php?TransNo=' . $myrow['orderno']; } else { /*pre-printed stationery default */ $PrintDispatchNote = $rootpath . '/PrintCustOrder.php?TransNo=' . $myrow['orderno']; } $PrintQuotation = $rootpath . '/PDFQuotation.php?QuotationNo=' . $myrow['orderno']; + $PrintQuotationPortrait = $rootpath . '/PDFQuotationPortrait.php?QuotationNo=' . $myrow['orderno']; $FormatedDelDate = ConvertSQLDate($myrow['deliverydate']); $FormatedOrderDate = ConvertSQLDate($myrow['orddate']); $FormatedOrderValue = locale_number_format($myrow['ordervalue'],$_SESSION['CompanyRecord']['decimalplaces']); - + if ($myrow['printedpackingslip']==0) { $PrintText = _('Print'); } else { $PrintText = _('Reprint'); } - + if ($_POST['Quotations']=='Orders_Only'){ - + /*Check authority to create POs if user has authority then show the check boxes to select sales orders to place POs for otherwise don't provide this option */ if ($AuthRow['cancreate']==0 AND $myrow['poplaced']==0){ //cancreate==0 if the user can create POs and not already placed printf('<td><a href="%s">%s</a></td> @@ -948,10 +949,10 @@ html_entity_decode($myrow['deliverto'],ENT_QUOTES,'UTF-8'), $FormatedOrderValue); } - + } else { /*must be quotes only */ printf('<td><a href="%s">%s</a></td> - <td><a target="_blank" href="%s">' . $PrintText . '</a></td> + <td><a target="_blank" href="%s">' . _('Landscape') . '</a> <a target="_blank" href="%s">' . _('Portrait') . '</a></td> <td>%s</td> <td>%s</td> <td>%s</td> @@ -963,6 +964,7 @@ $ModifyPage, $myrow['orderno'], $PrintQuotation, + $PrintQuotationPortrait, $myrow['name'], $myrow['brname'], $myrow['customerref'], @@ -980,9 +982,9 @@ } //end of page full new headings if }//end while loop through orders to display - if ($_POST['Quotations']=='Orders_Only' + if ($_POST['Quotations']=='Orders_Only' AND $AuthRow['cancreate']==0){ //cancreate==0 means can create POs - + echo '<tr><td colspan="11" class="number"><input type="submit" name="PlacePO" value="' . _('Place') . " " . _('PO') . '" onclick="return confirm(\'' . _('This will create purchase orders for all the items on the checked sales orders above, based on the preferred supplier purchasing data held in the system. Are You Absolutely Sure?') . '\');" /></td</tr>'; } echo '<tr><td colspan="9" class="number">'; @@ -995,7 +997,7 @@ <td class="number"><b>' . locale_number_format($OrdersTotal,$_SESSION['CompanyRecord']['decimalplaces']) . '</b></td> </tr> </table>'; - } //end if there are some orders to show + } //end if there are some orders to show } echo '</div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |