From: <dai...@us...> - 2011-02-06 04:29:40
|
Revision: 4482 http://web-erp.svn.sourceforge.net/web-erp/?rev=4482&view=rev Author: daintree Date: 2011-02-06 04:29:33 +0000 (Sun, 06 Feb 2011) Log Message: ----------- PO stuff Modified Paths: -------------- trunk/PDFGrn.php trunk/PO_Items.php trunk/SystemParameters.php trunk/UpgradeDatabase.php trunk/doc/Change.log.html trunk/includes/ConnectDB.inc trunk/includes/DateFunctions.inc trunk/includes/DefinePOClass.php trunk/includes/PDFGrnHeader.inc trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/PDFGrn.php =================================================================== --- trunk/PDFGrn.php 2011-02-04 22:50:18 UTC (rev 4481) +++ trunk/PDFGrn.php 2011-02-06 04:29:33 UTC (rev 4482) @@ -4,7 +4,6 @@ //$PageSecurity = 2; Now comes from DB - read in from session include('includes/session.inc'); -include('includes/DefinePOClass.php'); if (isset($_GET['GRNNo'])) { $GRNNo=$_GET['GRNNo']; @@ -12,11 +11,7 @@ $GRNNo=''; } -if ($GRNNo=='Preview') { - $FormDesign = simplexml_load_file(sys_get_temp_dir().'/GoodsReceived.xml'); -} else { - $FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/GoodsReceived.xml'); -} +$FormDesign = simplexml_load_file($PathPrefix.'companies/'.$_SESSION['DatabaseName'].'/FormDesigns/GoodsReceived.xml'); // Set the paper size/orintation $PaperSize = $FormDesign->PaperSize; @@ -25,84 +20,83 @@ include('includes/PDFStarter.php'); $pdf->addInfo('Title', _('Goods Received Note') ); -if ($GRNNo=='Preview') { - $ListCount = 1; -} else { - $sql="SELECT grns.itemcode, - grns.grnno, - grns.deliverydate, - grns.itemdescription, - grns.qtyrecd, - grns.supplierid, - grns.podetailitem - FROM grns - WHERE grnbatch='".$GRNNo."'"; - $GRNResult=DB_query($sql, $db); - $NoOfGRNs = DB_num_rows($GRNResult); - if ($NoOfGRNs>0){ - $_GET['ModifyOrderNumber'] = (int)$_GET['PONo']; - $identifier=date('U'); - include('includes/PO_ReadInOrder.inc'); //Read the PO in - include('includes/PDFGrnHeader.inc'); - } -} -$i=1; -$YPos=$FormDesign->Data->y; -while ($i<=$NoOfGRNs) { - if ($GRNNo=='Preview') { - $StockID=str_pad('',10,'x'); - $Date='1/1/1900'; - $Description=str_pad('',30,'x'); - $SuppliersQuantity='XXXXX.XX'; - $OurUnitsQuantity='XXXXX.XX'; - $Supplier=str_pad('',25,'x'); - $Units = str_pad('',10,'x'); - $SupplierUnits =str_pad('',10,'x'); - } else { - $myrow = DB_fetch_array($GRNResult); - $LineNo = $_SESSION['PO'.$identifier]->GetLineNoFromPODetailItem($myrow['podetailitem']); - echo '<br />The podetailitem is ' . $myrow['podetailitem'] . '<br />Got the line number it is: ' . $LineNo; - $StockID=$myrow['itemcode']; - $GRNNo=$myrow['grnno']; - $Date=ConvertSQLDate($myrow['deliverydate']); - $Description=$myrow['itemdescription']; - $SuppliersQuantity=number_format($myrow['qtyrecd']/$_SESSION['PO' . $identifier]->LineItems[$LineNo]->ConversionFactor,$_SESSION['PO' . $identifier]->LineItems[$LineNo]->DecimalPlaces); - $OurUnitsQuantity=number_format($myrow['qtyrecd'],$_SESSION['PO' . $identifier]->LineItems[$LineNo]->DecimalPlaces); - $SupplierID=$myrow['supplierid']; - $Units = $_SESSION['PO' . $identifier]->LineItems[$LineNo]->Units; - $SuppliersUnit = $_SESSION['PO' . $identifier]->LineItems[$LineNo]->SuppliersUnit; - $Supplier = $_SESSION['PO' . $identifier]->SupplierName; - } - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$Page_Height-$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $StockID); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$Page_Height-$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $Description); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x,$Page_Height-$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $Date); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x,$Page_Height-$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize, $SuppliersQuantity, 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x,$Page_Height-$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize, $SuppliersUnit, 'left'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column6->x,$Page_Height-$YPos,$FormDesign->Data->Column6->Length,$FormDesign->Data->Column6->FontSize, $OurUnitsQuantity, 'right'); - $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column7->x,$Page_Height-$YPos,$FormDesign->Data->Column7->Length,$FormDesign->Data->Column7->FontSize, $Units, 'left'); - $YPos += $line_height; - $i++; - if ($YPos >= $FormDesign->LineAboveFooter->starty){ - /* We reached the end of the page so finsih off the page and start a newy */ - $PageNumber++; - $YPos=$FormDesign->Data->y; - include ('includes/PDFGrnHeader.inc'); - } //end if need a new page headed up -} +$sql="SELECT grns.itemcode, + grns.grnno, + grns.deliverydate, + grns.itemdescription, + grns.qtyrecd, + grns.supplierid, + purchorderdetails.suppliersunit, + purchorderdetails.conversionfactor, + stockmaster.units, + stockmaster.decimalplaces + FROM grns INNER JOIN purchorderdetails + ON grns.podetailitem=purchorderdetails.podetailitem + LEFT JOIN stockmaster + ON grns.itemcode=stockmaster.stockid + WHERE grnbatch='".$GRNNo."'"; -$LeftOvers = $pdf->addText($FormDesign->ReceiptDate->x,$Page_Height-$FormDesign->ReceiptDate->y,$FormDesign->ReceiptDate->FontSize, _('Date of Receipt: ').$Date); +$GRNResult=DB_query($sql, $db); -$LeftOvers = $pdf->addText($FormDesign->SignedFor->x,$Page_Height-$FormDesign->SignedFor->y,$FormDesign->SignedFor->FontSize, _('Signed for ').'______________________'); +if(DB_num_rows($GRNResult)>0) { //there are GRNs to print + + $sql = "SELECT suppliers.suppname, + suppliers.address1, + suppliers.address2 , + suppliers.address3, + suppliers.address4, + suppliers.address5, + suppliers.address6 + FROM grns INNER JOIN suppliers + ON grns.supplierid=suppliers.supplierid + WHERE grnbatch='".$GRNNo."'"; + $SuppResult = DB_query($sql,$db,_('Could not get the supplier of the selected GRN')); + $SuppRow = DB_fetch_array($SuppResult); + + include ('includes/PDFGrnHeader.inc'); //head up the page + + $YPos=$FormDesign->Data->y; + while ($myrow = DB_fetch_array($GRNResult)) { -if ($NoOfGRNs == 0) { - $title = _('GRN Error'); + if (is_numeric($myrow['decimalplaces'])){ + $DecimalPlaces=$myrow['decimalplaces']; + } else { + $DecimalPlaces=2; + } + if (is_numeric($myrow['conversionfactor']) AND $myrow['conversionfactor'] !=0){ + $SuppliersQuantity=number_format($myrow['qtyrecd']/$myrow['conversionfactor'],$DecimalPlaces); + } else { + $SuppliersQuantity=number_format($myrow['qtyrecd'],$DecimalPlaces); + } + $OurUnitsQuantity=number_format($myrow['qtyrecd'],$DecimalPlaces); + $DeliveryDate = ConvertSQLDate($myrow['deliverydate']); + + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column1->x,$Page_Height-$YPos,$FormDesign->Data->Column1->Length,$FormDesign->Data->Column1->FontSize, $myrow['itemcode']); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column2->x,$Page_Height-$YPos,$FormDesign->Data->Column2->Length,$FormDesign->Data->Column2->FontSize, $myrow['itemdescription']); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column3->x,$Page_Height-$YPos,$FormDesign->Data->Column3->Length,$FormDesign->Data->Column3->FontSize, $DeliveryDate); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column4->x,$Page_Height-$YPos,$FormDesign->Data->Column4->Length,$FormDesign->Data->Column4->FontSize, $SuppliersQuantity, 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column5->x,$Page_Height-$YPos,$FormDesign->Data->Column5->Length,$FormDesign->Data->Column5->FontSize, $myrow['suppliersunit'], 'left'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column6->x,$Page_Height-$YPos,$FormDesign->Data->Column6->Length,$FormDesign->Data->Column6->FontSize, $OurUnitsQuantity, 'right'); + $LeftOvers = $pdf->addTextWrap($FormDesign->Data->Column7->x,$Page_Height-$YPos,$FormDesign->Data->Column7->Length,$FormDesign->Data->Column7->FontSize, $myrow['units'], 'left'); + $YPos += $line_height; + + if ($YPos >= $FormDesign->LineAboveFooter->starty){ + /* We reached the end of the page so finsih off the page and start a newy */ + $PageNumber++; + $YPos=$FormDesign->Data->y; + include ('includes/PDFGrnHeader.inc'); + } //end if need a new page headed up + } //end of loop around GRNs to print + + $LeftOvers = $pdf->addText($FormDesign->ReceiptDate->x,$Page_Height-$FormDesign->ReceiptDate->y,$FormDesign->ReceiptDate->FontSize, _('Date of Receipt: ') . $DeliveryDate); + $LeftOvers = $pdf->addText($FormDesign->SignedFor->x,$Page_Height-$FormDesign->SignedFor->y,$FormDesign->SignedFor->FontSize, _('Signed for ').'______________________'); + $pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf');//UldisN + $pdf->__destruct(); //UldisN +} else { //there were not GRNs to print + $title = _('GRN Error'); include('includes/header.inc'); prnMsg(_('There were no GRNs to print'),'warn'); echo '<br><a href="'.$rootpath.'/index.php?' . SID . '">'. _('Back to the menu').'</a>'; include('includes/footer.inc'); - exit; -} else { - $pdf->OutputD($_SESSION['DatabaseName'] . '_GRN_' . date('Y-m-d').'.pdf');//UldisN - $pdf->__destruct(); //UldisN } ?> \ No newline at end of file Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-02-04 22:50:18 UTC (rev 4481) +++ trunk/PO_Items.php 2011-02-06 04:29:33 UTC (rev 4482) @@ -20,7 +20,7 @@ */ if (!isset($_SESSION['PO'.$identifier])){ - header('Location:' . $rootpath . '/PO_Header.php?' . SID); + header('Location:' . $rootpath . '/PO_Header.php'); exit; } //end if (!isset($_SESSION['PO'.$identifier])) @@ -29,7 +29,7 @@ $Maximum_Number_Of_Parts_To_Show=50; if (!isset($_POST['Commit'])) { - echo '<a href="'.$rootpath.'/PO_Header.php?' . SID . 'identifier=' . $identifier. '">' ._('Back To Purchase Order Header') . '</a><br />'; + echo '<a href="'.$rootpath.'/PO_Header.php?identifier=' . $identifier. '">' ._('Back To Purchase Order Header') . '</a><br />'; } if (isset($_POST['UpdateLines']) OR isset($_POST['Commit'])) { @@ -80,11 +80,52 @@ $result = DB_Txn_Begin($db); + /*figure out what status to set the order to */ + if (IsEmailAddress($_SESSION['UserEmail'])){ + $UserDetails = ' <a href="mailto:' . $_SESSION['UserEmail'] . '">' . $_SESSION['UsersRealName']. '</a>'; + } else { + $UserDetails = ' ' . $_SESSION['UsersRealName'] . ' '; + } + if ($_SESSION['AutoAuthorisePO']==1) { //if the user has authority to authorise the PO then it will automatically be authorised + $AuthSQL ="SELECT authlevel + FROM purchorderauth + WHERE userid='".$_SESSION['UserID']."' + AND currabrev='".$_SESSION['PO'.$identifier]->CurrCode."'"; + + $AuthResult=DB_query($AuthSQL,$db); + $AuthRow=DB_fetch_array($AuthResult); + + if (DB_num_rows($AuthResult) > 0 AND $AuthRow['authlevel'] > $_SESSION['PO'.$identifier]->Order_Value()) { //user has authority to authrorise as well as create the order + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created and Authorised by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br />'; + $_SESSION['PO'.$identifier]->AllowPrintPO=1; + $_SESSION['PO'.$identifier]->Status = 'Authorised'; + } else { // no authority to authorise this order + if (DB_num_rows($AuthResult) ==0){ + $AuthMessage = _('Your authority to approve purchase orders in') . ' ' . $_SESSION['PO'.$identifier]->CurrCode . ' ' . _('has not yet been set up') . '<br />'; + } else { + $AuthMessage = _('You can only authorise up to').' '.$_SESSION['PO'.$identifier]->CurrCode.' '.$AuthorityLevel.'.<br />'; + } + + prnMsg( _('You do not have permission to authorise this purchase order').'.<br />'. _('This order is for').' '. + $_SESSION['PO'.$identifier]->CurrCode . ' '. $_SESSION['PO'.$identifier]->Order_Value() .'. '. + $AuthMessage . + _('If you think this is a mistake please contact the systems administrator') . '<br />'. + _('The order will be created with a status of pending and will require authorisation'), 'warn'); + + $_SESSION['PO'.$identifier]->AllowPrintPO=0; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br />'; + $_SESSION['PO'.$identifier]->Status = 'Pending'; + } + } else { //auto authorise is set to off + $_SESSION['PO'.$identifier]->AllowPrintPO=0; + $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . $UserDetails . ' - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br />'; + $_SESSION['PO'.$identifier]->Status = 'Pending'; + } + if ($_SESSION['ExistingOrder']==0){ /*its a new order to be inserted */ //Do we need to check authorisation to create - no because already trapped when new PO session started - $StatusComment=date($_SESSION['DefaultDateFormat']).' - ' . _('Order Created by') . ' <a href="mailto:'. $_SESSION['UserEmail'] .'">' . $_SESSION['PO'.$identifier]->Initiator . '</a> - '.$_SESSION['PO'.$identifier]->StatusMessage.'<br />'; - + /*Get the order number */ $_SESSION['PO'.$identifier]->OrderNo = GetNextTransNo(18, $db); @@ -119,7 +160,8 @@ status, stat_comment, deliverydate, - paymentterms) + paymentterms, + allowprint) VALUES( '" . $_SESSION['PO'.$identifier]->OrderNo . "', '" . $_SESSION['PO'.$identifier]->SupplierID . "', '" . $_SESSION['PO'.$identifier]->Comments . "', @@ -147,10 +189,11 @@ '" . $_SESSION['PO'.$identifier]->Version . "', '" . Date('Y-m-d') . "', '" . $_SESSION['PO'.$identifier]->DeliveryBy . "', - 'Pending', + '" . $_SESSION['PO'.$identifier]->Status . "', '" . $StatusComment . "', '" . FormatDateForSQL($_SESSION['PO'.$identifier]->DeliveryDate) . "', - '" . $_SESSION['PO'.$identifier]->PaymentTerms. "' + '" . $_SESSION['PO'.$identifier]->PaymentTerms. "', + '" . $_SESSION['PO'.$identifier]->AllowPrintPO . "' )"; $ErrMsg = _('The purchase order header record could not be inserted into the database because'); @@ -245,7 +288,7 @@ contact='" . $_SESSION['PO'.$identifier]->Contact . "', paymentterms='" . $_SESSION['PO'.$identifier]->PaymentTerms . "', allowprint='" . $_SESSION['PO'.$identifier]->AllowPrintPO . "', - status = 'Pending' + status = '" . $_SESSION['PO'.$identifier]->Status . "' WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'"; $ErrMsg = _('The purchase order could not be updated because'); @@ -474,7 +517,7 @@ } if ($AllowUpdate == true){ - + //adding the non-stock item $_SESSION['PO'.$identifier]->add_to_order ($_SESSION['PO'.$identifier]->LinesOnOrder+1, '', 0, /*Serialised */ @@ -482,35 +525,35 @@ $_POST['Qty'], $_POST['ItemDescription'], $_POST['Price'], - $_POST['uom'], + $_POST['SuppliersUnit'], $_POST['GLCode'], $_POST['ReqDelDate'], - $_POST['ShiptRef'], + '', 0, - $_POST['JobRef'], + '', 0, 0, $GLAccountName, - $_POST['DecimalPlaces'], - $_POST['ItemNo'], - $_POST['SuppliersUOM'], - $_POST['ConversionFactor'], - $_POST['LeadTime'], - $_POST['Suppliers_PartNo'], - $_POST['SubTotal_Amount'], - $_POST['Package'], - $_POST['PcUnit'], - $_POST['NetWeight'], - $_POST['KGs'], - $_POST['CuFt'], - $_POST['Total_Quantity'], - $_POST['Total_Amount'], + 2, + '', + $_POST['SuppliersUnit'], + 1, + '', + '', + ($_POST['Qty']*$_POST['Price']), + '', + '', + '', + '', + '', + $_POST['Qty'], + ($_POST['Qty']*$_POST['Price']), $_POST['AssetID']); include ('includes/PO_UnsetFormVbls.php'); } } - /*end if Enter line button was hit */ + /*end if Enter line button was hit - adding non stock items */ if (isset($_POST['NewItem'])){ @@ -759,9 +802,11 @@ echo'</select><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> + <td><input type="text" class="number" name="Qty" size="10" value="1"></td></tr> <tr><td>'._('Price per item').'</td> - <td><input type="text" class="number" name="Price" size=10></td></tr> + <td><input type="text" class="number" name="Price" size="10"></td></tr> + <tr><td>'._('Unit').'</td> + <td><input type="text" name="SuppliersUnit" size="10" value="' . _('each') . '"></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>'; Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2011-02-04 22:50:18 UTC (rev 4481) +++ trunk/SystemParameters.php 2011-02-06 04:29:33 UTC (rev 4482) @@ -282,6 +282,9 @@ if ($_SESSION['FrequentlyOrderedItems'] != $_POST['X_FrequentlyOrderedItems']){ $sql[] = "UPDATE config SET confvalue='" . $_POST['X_FrequentlyOrderedItems'] . "' WHERE confname='FrequentlyOrderedItems'"; } + if ($_SESSION['AutoAuthorisePO'] != $_POST['X_AutoAuthorisePO']){ + $sql[] = "UPDATE config SET confvalue='" . $_POST['X_AutoAuthorisePO'] . "' WHERE confname='AutoAuthorisePO'"; + } $ErrMsg = _('The system configuration could not be updated because'); if (sizeof($sql) > 1 ) { $result = DB_Txn_Begin($db); @@ -390,6 +393,13 @@ <td><input type="Text" class="number" Name="X_FrequentlyOrderedItems" value="' . $_SESSION['FrequentlyOrderedItems'] . '" size=3 maxlength=2></td> <td>' . _('To show the most frequently ordered items enter the number of frequently ordered items you wish to display from 1 to 99. If you do not wish to display the frequently ordered item list enter 0.') . '</td></tr>'; +// SO_AllowSameItemMultipleTimes +echo '<tr style="outline: 1px solid"><td>' . _('Sales Order Allows Same Item Multiple Times') . ':</td> + <td><select Name="X_SO_AllowSameItemMultipleTimes"> + <option '.($_SESSION['SO_AllowSameItemMultipleTimes']?'selected ':'').'value="1">'._('Yes').' + <option '.(!$_SESSION['SO_AllowSameItemMultipleTimes']?'selected ':'').'value="0">'._('No').' + </select></td><td> </td></tr>'; + //'AllowOrderLineItemNarrative' echo '<tr style="outline: 1px solid"><td>' . _('Order Entry allows Line Item Narrative') . ':</td> <td><select Name="X_AllowOrderLineItemNarrative"> @@ -444,16 +454,6 @@ <td>' . _('Customer branches can be set by default not to print packing slips with the company logo and address. This is useful for companies that ship to customers customers and to show the source of the shipment would be inappropriate. There is an option on the setup of customer branches to ship blind, this setting is the default applied to all new customer branches') . '</td> </tr>'; -//Show values on GRN -echo '<tr style="outline: 1px solid"><td>' . _('Show order values on GRN') . ':</td> - <td><select Name="X_ShowValueOnGRN"> - <option '.($_SESSION['ShowValueOnGRN']?'selected ':'').'value="1">'._('Yes').' - <option '.(!$_SESSION['ShowValueOnGRN']?'selected ':'').'value="0">'._('No').' - </select></td> - <td>' . _('Should the value of the purchased stock be shown on the GRN screen') . '</td> - </tr>'; - - // DispatchCutOffTime echo '<tr style="outline: 1px solid"><td>' . _('Dispatch Cut-Off Time') . ':</td> <td><select Name="X_DispatchCutOffTime">'; @@ -583,6 +583,15 @@ echo '<option '.($_SESSION['NumberOfPeriodsOfStockUsage'] == $i?'selected ':'').'value="'.$i.'">'.$i; echo '</select></td><td>' . _('In stock usage inquiries this determines how many periods of stock usage to show. An average is calculated over this many periods') .'</td></tr>'; +//Show values on GRN +echo '<tr style="outline: 1px solid"><td>' . _('Show order values on GRN') . ':</td> + <td><select Name="X_ShowValueOnGRN"> + <option '.($_SESSION['ShowValueOnGRN']?'selected ':'').'value="1">'._('Yes').' + <option '.(!$_SESSION['ShowValueOnGRN']?'selected ':'').'value="0">'._('No').' + </select></td> + <td>' . _('Should the value of the purchased stock be shown on the GRN screen') . '</td> + </tr>'; + // Check_Qty_Charged_vs_Del_Qty echo '<tr style="outline: 1px solid"><td>' . _('Check Quantity Charged vs Deliver Qty') . ':</td> <td><select Name="X_Check_Qty_Charged_vs_Del_Qty"> @@ -612,17 +621,18 @@ // PO_AllowSameItemMultipleTimes echo '<tr style="outline: 1px solid"><td>' . _('Purchase Order Allows Same Item Multiple Times') . ':</td> <td><select Name="X_PO_AllowSameItemMultipleTimes"> - <option '.($_SESSION['PO_AllowSameItemMultipleTimes']?'selected ':'').'value="1">'._('Yes').' - <option '.(!$_SESSION['PO_AllowSameItemMultipleTimes']?'selected ':'').'value="0">'._('No').' + <option '.($_SESSION['PO_AllowSameItemMultipleTimes']?'selected ':'').'value="1">'._('Yes') . '</option> + <option '.(!$_SESSION['PO_AllowSameItemMultipleTimes']?'selected ':'').'value="0">'._('No') . '</option> </select></td> <td></td></tr>'; -// SO_AllowSameItemMultipleTimes -echo '<tr style="outline: 1px solid"><td>' . _('Sales Order Allows Same Item Multiple Times') . ':</td> - <td><select Name="X_SO_AllowSameItemMultipleTimes"> - <option '.($_SESSION['SO_AllowSameItemMultipleTimes']?'selected ':'').'value="1">'._('Yes').' - <option '.(!$_SESSION['SO_AllowSameItemMultipleTimes']?'selected ':'').'value="0">'._('No').' - </select></td><td> </td></tr>'; +// AutoAuthorisePO +echo '<tr style="outline: 1px solid"><td>' . _('Automatically authorise purchase orders if user has authority') . ':</td> + <td><select Name="X_AutoAuthorisePO"> + <option '.($_SESSION['AutoAuthorisePO'] ?'selected ':'').'value="1">'._('Yes').' + <option '.(!$_SESSION['AutoAuthorisePO'] ?'selected ':'').'value="0">'._('No').' + </select></td>' . _('If the user changing an existing purchase order or adding a new puchase order is set up to authorise purchase orders and the order is within their limit, then the purchase order status is automatically set to authorised') . '<td></td></tr>'; + echo '<tr><th colspan=3>' . _('General Settings') . '</th></tr>'; echo $TableHeader; Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-02-04 22:50:18 UTC (rev 4481) +++ trunk/UpgradeDatabase.php 2011-02-06 04:29:33 UTC (rev 4482) @@ -1,6 +1,8 @@ <?php -/* $Id: $*/ -$PageSecurity = 15; +/* $Id UpgradeDatabase.php 4183 2010-12-14 09:30:20Z daintree $ */ + +$PageSecurity = 15; //hard coded in case database is old and PageSecurity stuff cannot be retrieved + include('includes/session.inc'); $title = _('Upgrade webERP Database'); include('includes/header.inc'); @@ -144,6 +146,9 @@ case 1050: echo '<td bgcolor="yellow">'._('Note').' - '. _('Table has already been created').'</td></tr>'; break; + case 1054: + echo '<td bgcolor="yellow">'._('Note').' - '. _('Column has already been changed').'</td></tr>'; + break; case 1060: echo '<td bgcolor="yellow">'._('Note').' - '. _('Column has already been created').'</td></tr>'; break; @@ -166,7 +171,7 @@ echo '<td bgcolor="red">'._('Failure').' - '. _('Error number').' - '.DB_error_no($db) .' ' . DB_error_msg($db) . '</td></tr>'; break; } - unset($sql); + $sql=''; } } //end if its a valid sql line not a comment } //end of for loop around the lines of the sql script Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-02-04 22:50:18 UTC (rev 4481) +++ trunk/doc/Change.log.html 2011-02-06 04:29:33 UTC (rev 4482) @@ -1,5 +1,10 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p <p></p> +<p>5/2/11: Phil: SystemParameters.php new option to AutoAuthorisePO when the user has authority to do so</p> +<p>5/2/11: Phil: PO_Items.php fixed non-existant variables on Enter nominal line. Added option to automatically authorise when user is an authoriser as well as a creator</p> +<p>5/2/11: PDFGrn.php rewrote - preview never used - confused logic fixed<p> +<p>4/2/11: Tim CostUpdate.php </p> +<p>4/2/11: Phil SelectCustomer.php rejig selection options in more logical way. Used non-specific SQL to search by any part of the address</p> <p>2/2/11: Phil PDFTopItems.php and TopItems.php removed mysql specific SQL</p> <p>30/1/11: Phil GoodsReceived.php rework for supplier units and conversion factor etc now in PO class</p> <p>30/1/11: Phil PDFGrn.php rework for supplier units and conversion factor etc now in PO class</p> Modified: trunk/includes/ConnectDB.inc =================================================================== --- trunk/includes/ConnectDB.inc 2011-02-04 22:50:18 UTC (rev 4481) +++ trunk/includes/ConnectDB.inc 2011-02-06 04:29:33 UTC (rev 4482) @@ -4,7 +4,7 @@ * this value is saved in the $_SESSION['Versionumber'] when includes/GetConfig.php is run * if VersionNumber is < $Version then the DB update script is run */ -$Version='3.12.31'; //must update manually every time there is a DB change +$Version='3.12.32'; //must update manually every time there is a DB change require_once ($PathPrefix .'includes/MiscFunctions.php'); Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-02-04 22:50:18 UTC (rev 4481) +++ trunk/includes/DateFunctions.inc 2011-02-06 04:29:33 UTC (rev 4482) @@ -160,6 +160,22 @@ $Date_Array = explode('-',$DateEntry); } elseif (strpos ($DateEntry,'.')) { $Date_Array = explode('.',$DateEntry); + } else { + prnMsg(_('The date does not appear to be in a valid format. The date being converted from SQL format was:') . ' ' . $DateEntry,'error'); + switch ($_SESSION['DefaultDateFormat']) { + case 'd/m/Y': + return '0/0/000'; + break; + case 'd.m.Y': + return '0.0.000'; + break; + case 'm/d/Y': + return '0/0/0000'; + break; + case 'Y/m/d': + return '0000/0/0'; + break; + } } if (strlen($Date_Array[2])>4) { /*chop off the time stuff */ Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2011-02-04 22:50:18 UTC (rev 4481) +++ trunk/includes/DefinePOClass.php 2011-02-06 04:29:33 UTC (rev 4482) @@ -226,15 +226,6 @@ return 0; //nowt received } - function GetLineNoFromPODetailItem($PODetailItem){ - foreach ($this->LineItems as $OrderedItems) { - if ($OrderedItems->PODetailRec ==$PODetailItem){ - return $OrderedItems->LineNo; - } - } - return false; //PODetailItem not on the order - } - } /* end of class defintion */ Class LineDetails { Modified: trunk/includes/PDFGrnHeader.inc =================================================================== --- trunk/includes/PDFGrnHeader.inc 2011-02-04 22:50:18 UTC (rev 4481) +++ trunk/includes/PDFGrnHeader.inc 2011-02-06 04:29:33 UTC (rev 4482) @@ -5,30 +5,15 @@ $pdf->newPage(); } -$sql="SELECT suppliers.supplierid, - suppname, - address1, - address2 , - address3, - address4, - address5, - address6 - FROM suppliers - LEFT JOIN grns - ON grns.supplierid=suppliers.supplierid - WHERE grnbatch='".$GRNNo."'"; -$supplierresult=DB_query($sql, $db); -$supplierrow=DB_fetch_array($supplierresult); - $pdf->addJpegFromFile($_SESSION['LogoFile'] ,$FormDesign->logo->x,$Page_Height-$FormDesign->logo->y,$FormDesign->logo->width,$FormDesign->logo->height); -$LeftOvers = $pdf->addText($FormDesign->SupplierName->x,$Page_Height-$FormDesign->SupplierName->y,$FormDesign->SupplierName->FontSize,$supplierrow['suppname']); -$LeftOvers = $pdf->addText($FormDesign->SupplierAddress1->x,$Page_Height-$FormDesign->SupplierAddress1->y,$FormDesign->SupplierAddress1->FontSize,$supplierrow['address1']); -$LeftOvers = $pdf->addText($FormDesign->SupplierAddress2->x,$Page_Height-$FormDesign->SupplierAddress2->y,$FormDesign->SupplierAddress2->FontSize,$supplierrow['address2']); -$LeftOvers = $pdf->addText($FormDesign->SupplierAddress3->x,$Page_Height-$FormDesign->SupplierAddress3->y,$FormDesign->SupplierAddress3->FontSize,$supplierrow['address3']); -$LeftOvers = $pdf->addText($FormDesign->SupplierAddress4->x,$Page_Height-$FormDesign->SupplierAddress4->y,$FormDesign->SupplierAddress4->FontSize,$supplierrow['address4']); -$LeftOvers = $pdf->addText($FormDesign->SupplierAddress5->x,$Page_Height-$FormDesign->SupplierAddress5->y,$FormDesign->SupplierAddress5->FontSize,$supplierrow['address5']); -$LeftOvers = $pdf->addText($FormDesign->SupplierAddress6->x,$Page_Height-$FormDesign->SupplierAddress6->y,$FormDesign->SupplierAddress6->FontSize,$supplierrow['address6']); +$LeftOvers = $pdf->addText($FormDesign->SupplierName->x,$Page_Height-$FormDesign->SupplierName->y,$FormDesign->SupplierName->FontSize,$SuppRow['suppname']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress1->x,$Page_Height-$FormDesign->SupplierAddress1->y,$FormDesign->SupplierAddress1->FontSize,$SuppRow['address1']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress2->x,$Page_Height-$FormDesign->SupplierAddress2->y,$FormDesign->SupplierAddress2->FontSize,$SuppRow['address2']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress3->x,$Page_Height-$FormDesign->SupplierAddress3->y,$FormDesign->SupplierAddress3->FontSize,$SuppRow['address3']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress4->x,$Page_Height-$FormDesign->SupplierAddress4->y,$FormDesign->SupplierAddress4->FontSize,$SuppRow['address4']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress5->x,$Page_Height-$FormDesign->SupplierAddress5->y,$FormDesign->SupplierAddress5->FontSize,$SuppRow['address5']); +$LeftOvers = $pdf->addText($FormDesign->SupplierAddress6->x,$Page_Height-$FormDesign->SupplierAddress6->y,$FormDesign->SupplierAddress6->FontSize,$SuppRow['address6']); $LeftOvers = $pdf->addText($FormDesign->CompanyName->x,$Page_Height-$FormDesign->CompanyName->y,$FormDesign->CompanyName->FontSize,$_SESSION['CompanyRecord']['coyname']); Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-02-04 22:50:18 UTC (rev 4481) +++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-02-06 04:29:33 UTC (rev 4482) @@ -813,4 +813,6 @@ ALTER TABLE `purchorderdetails` ADD `conversionfactor` DOUBLE NOT NULL DEFAULT '1'; UPDATE config SET confvalue='3.12.3' WHERE confname='VersionNumber'; ALTER TABLE `purchorderdetails` CHANGE `uom` `suppliersunit` VARCHAR( 50 ); -UPDATE config SET confvalue='3.12.31' WHERE confname='VersionNumber'; \ No newline at end of file +UPDATE config SET confvalue='3.12.31' WHERE confname='VersionNumber'; +INSERT INTO `weberpdemo`.`config` (`confname`, `confvalue`) VALUES ('AutoAuthorisePO', '1'); +UPDATE config SET confvalue='3.12.32' WHERE confname='VersionNumber'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |