From: <em...@us...> - 2009-09-15 02:22:30
|
Revision: 2492 http://web-erp.svn.sourceforge.net/web-erp/?rev=2492&view=rev Author: emdeex Date: 2009-09-15 02:22:17 +0000 (Tue, 15 Sep 2009) Log Message: ----------- Closes: #5 provides config option to SalesOrders FOI Modified Paths: -------------- trunk/SelectOrderItems.php trunk/SystemParameters.php trunk/sql/mysql/upgrade3.10-3.11.sql trunk/sql/mysql/weberp-demo.sql trunk/sql/mysql/weberp-new.sql Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2009-09-15 01:36:08 UTC (rev 2491) +++ trunk/SelectOrderItems.php 2009-09-15 02:22:17 UTC (rev 2492) @@ -1,1710 +1,1712 @@ -<?php -/* $Revision: 1.110 $ */ - -include('includes/DefineCartClass.php'); -$PageSecurity = 1; -/* Session started in session.inc for password checking and authorisation level check -config.php is in turn included in session.inc*/ - -include('includes/session.inc'); - -if (isset($_GET['ModifyOrderNumber'])) { - $title = _('Modifying Order') . ' ' . $_GET['ModifyOrderNumber']; -} else { - $title = _('Select Order Items'); -} - -include('includes/header.inc'); -include('includes/GetPrice.inc'); -include('includes/SQL_CommonFunctions.inc'); - -if (isset($_POST['QuickEntry'])){ - unset($_POST['PartSearch']); -} - -if (isset($_POST['order_items'])){ - foreach ($_POST as $key => $value) { - if (strstr($key,"itm")) { - $NewItem_array[substr($key,3)] = trim($value); - } - } -} - -if (isset($_GET['NewItem'])){ - $NewItem = trim($_GET['NewItem']); -} - - -if (empty($_GET['identifier'])) { - $identifier=date('U'); -} else { - $identifier=$_GET['identifier']; -} - -if (isset($_GET['NewOrder'])){ - /*New order entry - clear any existing order details from the Items object and initiate a newy*/ - if (isset($_SESSION['Items'.$identifier])){ - unset ($_SESSION['Items'.$identifier]->LineItems); - $_SESSION['Items'.$identifier]->ItemsOrdered=0; - unset ($_SESSION['Items'.$identifier]); - } - - $_SESSION['ExistingOrder']=0; - $_SESSION['Items'.$identifier] = new cart; - - if (count($_SESSION['AllowedPageSecurityTokens'])==1){ //its a customer logon - $_SESSION['Items'.$identifier]->DebtorNo=$_SESSION['CustomerID']; - $_SESSION['RequireCustomerSelection']=0; - } else { - $_SESSION['Items'.$identifier]->DebtorNo=''; - $_SESSION['RequireCustomerSelection']=1; - } - -} - -// removed to improve UI layout -//echo '<a href="'. $rootpath . '/SelectSalesOrder.php?' . SID . '">'. _('Back to Sales Orders'). '</a><br>'; - -if (isset($_GET['ModifyOrderNumber']) - AND $_GET['ModifyOrderNumber']!=''){ - -/* The delivery check screen is where the details of the order are either updated or inserted depending on the value of ExistingOrder */ - - if (isset($_SESSION['Items'.$identifier])){ - unset ($_SESSION['Items'.$identifier]->LineItems); - unset ($_SESSION['Items'.$identifier]); - } - $_SESSION['ExistingOrder']=$_GET['ModifyOrderNumber']; - $_SESSION['RequireCustomerSelection'] = 0; - $_SESSION['Items'.$identifier] = new cart; - -/*read in all the guff from the selected order into the Items cart */ - - $OrderHeaderSQL = 'SELECT salesorders.debtorno, - debtorsmaster.name, - salesorders.branchcode, - salesorders.customerref, - salesorders.comments, - salesorders.orddate, - salesorders.ordertype, - salestypes.sales_type, - salesorders.shipvia, - salesorders.deliverto, - salesorders.deladd1, - salesorders.deladd2, - salesorders.deladd3, - salesorders.deladd4, - salesorders.deladd5, - salesorders.deladd6, - salesorders.contactphone, - salesorders.contactemail, - salesorders.freightcost, - salesorders.deliverydate, - debtorsmaster.currcode, - paymentterms.terms, - salesorders.fromstkloc, - salesorders.printedpackingslip, - salesorders.datepackingslipprinted, - salesorders.quotation, - salesorders.deliverblind, - debtorsmaster.customerpoline, - locations.locationname, - custbranch.estdeliverydays, - custbranch.salesman - FROM salesorders, - debtorsmaster, - salestypes, - custbranch, - paymentterms, - locations - WHERE salesorders.ordertype=salestypes.typeabbrev - AND salesorders.debtorno = debtorsmaster.debtorno - AND salesorders.debtorno = custbranch.debtorno - AND salesorders.branchcode = custbranch.branchcode - AND debtorsmaster.paymentterms=paymentterms.termsindicator - AND locations.loccode=salesorders.fromstkloc - AND salesorders.orderno = ' . $_GET['ModifyOrderNumber']; - - - $ErrMsg = _('The order cannot be retrieved because'); - $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db,$ErrMsg); - - if (DB_num_rows($GetOrdHdrResult)==1) { - - $myrow = DB_fetch_array($GetOrdHdrResult); - if ($_SESSION['SalesmanLogin']!='' AND $_SESSION['SalesmanLogin']!=$myrow['salesman']){ - prnMsg(_('Your account is set up to see only a specific salespersons orders. You are not authorised to modify this order'),'error'); - include('includes/footer.inc'); - exit; - } - $_SESSION['Items'.$identifier]->OrderNo = $_GET['ModifyOrderNumber']; - $_SESSION['Items'.$identifier]->DebtorNo = $myrow['debtorno']; -/*CustomerID defined in header.inc */ - $_SESSION['Items'.$identifier]->Branch = $myrow['branchcode']; - $_SESSION['Items'.$identifier]->CustomerName = $myrow['name']; - $_SESSION['Items'.$identifier]->CustRef = $myrow['customerref']; - $_SESSION['Items'.$identifier]->Comments = stripcslashes($myrow['comments']); - $_SESSION['Items'.$identifier]->PaymentTerms =$myrow['terms']; - $_SESSION['Items'.$identifier]->DefaultSalesType =$myrow['ordertype']; - $_SESSION['Items'.$identifier]->SalesTypeName =$myrow['sales_type']; - $_SESSION['Items'.$identifier]->DefaultCurrency = $myrow['currcode']; - $_SESSION['Items'.$identifier]->ShipVia = $myrow['shipvia']; - $BestShipper = $myrow['shipvia']; - $_SESSION['Items'.$identifier]->DeliverTo = $myrow['deliverto']; - $_SESSION['Items'.$identifier]->DeliveryDate = ConvertSQLDate($myrow['deliverydate']); - $_SESSION['Items'.$identifier]->DelAdd1 = $myrow['deladd1']; - $_SESSION['Items'.$identifier]->DelAdd2 = $myrow['deladd2']; - $_SESSION['Items'.$identifier]->DelAdd3 = $myrow['deladd3']; - $_SESSION['Items'.$identifier]->DelAdd4 = $myrow['deladd4']; - $_SESSION['Items'.$identifier]->DelAdd5 = $myrow['deladd5']; - $_SESSION['Items'.$identifier]->DelAdd6 = $myrow['deladd6']; - $_SESSION['Items'.$identifier]->PhoneNo = $myrow['contactphone']; - $_SESSION['Items'.$identifier]->Email = $myrow['contactemail']; - $_SESSION['Items'.$identifier]->Location = $myrow['fromstkloc']; - $_SESSION['Items'.$identifier]->LocationName = $myrow['locationname']; - $_SESSION['Items'.$identifier]->Quotation = $myrow['quotation']; - $_SESSION['Items'.$identifier]->FreightCost = $myrow['freightcost']; - $_SESSION['Items'.$identifier]->Orig_OrderDate = $myrow['orddate']; - $_SESSION['PrintedPackingSlip'] = $myrow['printedpackingslip']; - $_SESSION['DatePackingSlipPrinted'] = $myrow['datepackingslipprinted']; - $_SESSION['Items'.$identifier]->DeliverBlind = $myrow['deliverblind']; - $_SESSION['Items'.$identifier]->DefaultPOLine = $myrow['customerpoline']; - $_SESSION['Items'.$identifier]->DeliveryDays = $myrow['estdeliverydays']; - -/*need to look up customer name from debtors master then populate the line items array with the sales order details records */ - - $LineItemsSQL = "SELECT salesorderdetails.orderlineno, - salesorderdetails.stkcode, - stockmaster.description, - stockmaster.volume, - stockmaster.kgs, - stockmaster.units, - stockmaster.serialised, - stockmaster.nextserialno, - stockmaster.eoq, - salesorderdetails.unitprice, - salesorderdetails.quantity, - salesorderdetails.discountpercent, - salesorderdetails.actualdispatchdate, - salesorderdetails.qtyinvoiced, - salesorderdetails.narrative, - salesorderdetails.itemdue, - salesorderdetails.poline, - locstock.quantity as qohatloc, - stockmaster.mbflag, - stockmaster.discountcategory, - stockmaster.decimalplaces, - stockmaster.materialcost+stockmaster.labourcost+stockmaster.overheadcost AS standardcost, - salesorderdetails.completed - FROM salesorderdetails INNER JOIN stockmaster - ON salesorderdetails.stkcode = stockmaster.stockid - INNER JOIN locstock ON locstock.stockid = stockmaster.stockid - WHERE locstock.loccode = '" . $myrow['fromstkloc'] . "' - AND salesorderdetails.orderno =" . $_GET['ModifyOrderNumber'] . " - ORDER BY salesorderdetails.orderlineno"; - - $ErrMsg = _('The line items of the order cannot be retrieved because'); - $LineItemsResult = db_query($LineItemsSQL,$db,$ErrMsg); - if (db_num_rows($LineItemsResult)>0) { - - while ($myrow=db_fetch_array($LineItemsResult)) { - if ($myrow['completed']==0){ - $_SESSION['Items'.$identifier]->add_to_cart($myrow['stkcode'], - $myrow['quantity'], - $myrow['description'], - $myrow['unitprice'], - $myrow['discountpercent'], - $myrow['units'], - $myrow['volume'], - $myrow['kgs'], - $myrow['qohatloc'], - $myrow['mbflag'], - $myrow['actualdispatchdate'], - $myrow['qtyinvoiced'], - $myrow['discountcategory'], - 0, /*Controlled*/ - $myrow['serialised'], - $myrow['decimalplaces'], - $myrow['narrative'], - 'No', /* Update DB */ - $myrow['orderlineno'], - // ConvertSQLDate($myrow['itemdue']), - 0, - '', - ConvertSQLDate($myrow['itemdue']), - $myrow['poline'], - $myrow['standardcost'], - $myrow['eoq'], - $myrow['nextserialno'] - ); - - /*Just populating with existing order - no DBUpdates */ - } - $LastLineNo = $myrow['orderlineno']; - } /* line items from sales order details */ - $_SESSION['Items'.$identifier]->LineCounter = $LastLineNo+1; - } //end of checks on returned data set - } -} - - -if (!isset($_SESSION['Items'.$identifier])){ - /* It must be a new order being created $_SESSION['Items'.$identifier] would be set up from the order - modification code above if a modification to an existing order. Also $ExistingOrder would be - set to 1. The delivery check screen is where the details of the order are either updated or - inserted depending on the value of ExistingOrder */ - - $_SESSION['ExistingOrder']=0; - $_SESSION['Items'.$identifier] = new cart; - $_SESSION['PrintedPackingSlip'] =0; /*Of course cos the order aint even started !!*/ - - if (in_array(2,$_SESSION['AllowedPageSecurityTokens']) AND ($_SESSION['Items'.$identifier]->DebtorNo=='' OR !isset($_SESSION['Items'.$identifier]->DebtorNo))){ - - /* need to select a customer for the first time out if authorisation allows it and if a customer - has been selected for the order or not the session variable CustomerID holds the customer code - already as determined from user id /password entry */ - $_SESSION['RequireCustomerSelection'] = 1; - } else { - $_SESSION['RequireCustomerSelection'] = 0; - } -} - -if (isset($_POST['ChangeCustomer']) AND $_POST['ChangeCustomer']!=''){ - - if ($_SESSION['Items'.$identifier]->Any_Already_Delivered()==0){ - $_SESSION['RequireCustomerSelection']=1; - } else { - prnMsg(_('The customer the order is for cannot be modified once some of the order has been invoiced'),'warn'); - } -} - -$msg=''; - -if (isset($_POST['SearchCust']) AND $_SESSION['RequireCustomerSelection']==1 AND in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ - - if (($_POST['CustKeywords']!='') AND (($_POST['CustCode']!='') OR ($_POST['CustPhone']!=''))) { - prnMsg( _('Customer Branch Name keywords have been used in preference to the Customer Branch Code or Branch Phone Number entered'), 'warn'); - } - if (($_POST['CustCode']!='') AND ($_POST['CustPhone']!='')) { - prnMsg(_('Customer Branch Code has been used in preference to the Customer Branch Phone Number entered'), 'warn'); - } - if (($_POST['CustKeywords']=='') AND ($_POST['CustCode']=='') AND ($_POST['CustPhone']=='')) { - prnMsg(_('At least one Customer Branch Name keyword OR an extract of a Customer Branch Code or Branch Phone Number must be entered for the search'), 'warn'); - } else { - if (strlen($_POST['CustKeywords'])>0) { - //insert wildcard characters in spaces - $_POST['CustKeywords'] = strtoupper(trim($_POST['CustKeywords'])); - $i=0; - $SearchString = '%'; - while (strpos($_POST['CustKeywords'], ' ', $i)) { - $wrdlen=strpos($_POST['CustKeywords'],' ',$i) - $i; - $SearchString=$SearchString . substr($_POST['CustKeywords'],$i,$wrdlen) . '%'; - $i=strpos($_POST['CustKeywords'],' ',$i) +1; - } - $SearchString = $SearchString. substr($_POST['CustKeywords'],$i).'%'; - - $SQL = "SELECT custbranch.brname, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.branchcode, - custbranch.debtorno - FROM custbranch - WHERE custbranch.brname " . LIKE . " '$SearchString'"; - - if ($_SESSION['SalesmanLogin']!=''){ - $SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'"; - } - $SQL .= ' AND custbranch.disabletrans=0 - ORDER BY custbranch.debtorno, custbranch.branchcode'; - - } elseif (strlen($_POST['CustCode'])>0){ - - $_POST['CustCode'] = strtoupper(trim($_POST['CustCode'])); - - $SQL = "SELECT custbranch.brname, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.branchcode, - custbranch.debtorno - FROM custbranch - WHERE custbranch.debtorno " . LIKE . " '%" . $_POST['CustCode'] . "%' OR custbranch.branchcode " . LIKE . " '%" . $_POST['CustCode'] . "%'"; - - if ($_SESSION['SalesmanLogin']!=''){ - $SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'"; - } - $SQL .= ' AND custbranch.disabletrans=0 - ORDER BY custbranch.debtorno'; - } elseif (strlen($_POST['CustPhone'])>0){ - $SQL = "SELECT custbranch.brname, - custbranch.contactname, - custbranch.phoneno, - custbranch.faxno, - custbranch.branchcode, - custbranch.debtorno - FROM custbranch - WHERE custbranch.phoneno " . LIKE . " '%" . $_POST['CustPhone'] . "%'"; - - if ($_SESSION['SalesmanLogin']!=''){ - $SQL .= " AND custbranch.salesman='" . $_SESSION['SalesmanLogin'] . "'"; - } - - $SQL .= ' AND custbranch.disabletrans=0 - ORDER BY custbranch.debtorno'; - } - - $ErrMsg = _('The searched customer records requested cannot be retrieved because'); - $result_CustSelect = DB_query($SQL,$db,$ErrMsg); - - if (DB_num_rows($result_CustSelect)==1){ - $myrow=DB_fetch_array($result_CustSelect); - $_POST['Select'] = $myrow['debtorno'] . ' - ' . $myrow['branchcode']; - } elseif (DB_num_rows($result_CustSelect)==0){ - prnMsg(_('No Customer Branch records contain the search criteria') . ' - ' . _('please try again') . ' - ' . _('Note a Customer Branch Name may be different to the Customer Name'),'info'); - } - } /*one of keywords or custcode was more than a zero length string */ -} /*end of if search for customer codes/names */ - - -// will only be true if page called from customer selection form or set because only one customer -// 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); - - $_POST['Select'] = substr($_POST['Select'],0,strpos($_POST['Select'],' - ')); - - // Now check to ensure this account is not on hold */ - $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 = '" . $_POST['Select'] . "'"; - - $ErrMsg = _('The details of the customer selected') . ': ' . $_POST['Select'] . ' ' . _('cannot be retrieved because'); - $DbgMsg = _('The SQL used to retrieve the customer details and failed was') . ':'; - $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); - - $myrow = DB_fetch_row($result); - if ($myrow[1] != 1){ - if ($myrow[1]==2){ - prnMsg(_('The') . ' ' . $myrow[0] . ' ' . _('account is currently flagged as an account that needs to be watched. Please contact the credit control personnel to discuss'),'warn'); - } - - $_SESSION['Items'.$identifier]->DebtorNo=$_POST['Select']; - $_SESSION['RequireCustomerSelection']=0; - $_SESSION['Items'.$identifier]->CustomerName = $myrow[0]; - -# the sales type determines the price list to be used by default the customer of the user is -# defaulted from the entry of the userid and password. - - $_SESSION['Items'.$identifier]->DefaultSalesType = $myrow[2]; - $_SESSION['Items'.$identifier]->SalesTypeName = $myrow[3]; - $_SESSION['Items'.$identifier]->DefaultCurrency = $myrow[4]; - $_SESSION['Items'.$identifier]->DefaultPOLine = $myrow[5]; - $_SESSION['Items'.$identifier]->PaymentTerms = $myrow[6]; - - - -# the branch was also selected from the customer selection so default the delivery details from the customer branches table CustBranch. The order process will ask for branch details later anyway - - $sql = "SELECT custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.phoneno, - custbranch.email, - custbranch.defaultlocation, - custbranch.defaultshipvia, - custbranch.deliverblind, - custbranch.specialinstructions, - custbranch.estdeliverydays, - locations.locationname, - custbranch.salesman - FROM custbranch - INNER JOIN locations - ON custbranch.defaultlocation=locations.loccode - 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'); - $DbgMsg = _('SQL used to retrieve the branch details was') . ':'; - $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); - - if (DB_num_rows($result)==0){ - - prnMsg(_('The branch details for branch code') . ': ' . $_SESSION['Items'.$identifier]->Branch . ' ' . _('against customer code') . ': ' . $_POST['Select'] . ' ' . _('could not be retrieved') . '. ' . _('Check the set up of the customer and branch'),'error'); - - if ($debug==1){ - echo '<br>' . _('The SQL that failed to get the branch details was') . ':<br>' . $sql; - } - include('includes/footer.inc'); - exit; - } - // add echo - echo '<br>'; - $myrow = DB_fetch_row($result); - if ($_SESSION['SalesmanLogin']!='' AND $_SESSION['SalesmanLogin']!=$myrow[15]){ - prnMsg(_('Your login is only set up for a particular salesperson. This customer has a different salesperson.'),'error'); - include('includes/footer.inc'); - exit; - } - - $_SESSION['Items'.$identifier]->DeliverTo = $myrow[0]; - $_SESSION['Items'.$identifier]->DelAdd1 = $myrow[1]; - $_SESSION['Items'.$identifier]->DelAdd2 = $myrow[2]; - $_SESSION['Items'.$identifier]->DelAdd3 = $myrow[3]; - $_SESSION['Items'.$identifier]->DelAdd4 = $myrow[4]; - $_SESSION['Items'.$identifier]->DelAdd5 = $myrow[5]; - $_SESSION['Items'.$identifier]->DelAdd6 = $myrow[6]; - $_SESSION['Items'.$identifier]->PhoneNo = $myrow[7]; - $_SESSION['Items'.$identifier]->Email = $myrow[8]; - $_SESSION['Items'.$identifier]->Location = $myrow[9]; - $_SESSION['Items'.$identifier]->ShipVia = $myrow[10]; - $_SESSION['Items'.$identifier]->DeliverBlind = $myrow[11]; - $_SESSION['Items'.$identifier]->SpecialInstructions = $myrow[12]; - $_SESSION['Items'.$identifier]->DeliveryDays = $myrow[13]; - $_SESSION['Items'.$identifier]->LocationName = $myrow[14]; - - if ($_SESSION['Items'.$identifier]->SpecialInstructions) - prnMsg($_SESSION['Items'.$identifier]->SpecialInstructions,'warn'); - - if ($_SESSION['CheckCreditLimits'] > 0){ /*Check credit limits is 1 for warn and 2 for prohibit sales */ - $_SESSION['Items'.$identifier]->CreditAvailable = GetCreditAvailable($_POST['Select'],$db); - - if ($_SESSION['CheckCreditLimits']==1 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ - prnMsg(_('The') . ' ' . $myrow[0] . ' ' . _('account is currently at or over their credit limit'),'warn'); - } elseif ($_SESSION['CheckCreditLimits']==2 AND $_SESSION['Items'.$identifier]->CreditAvailable <=0){ - prnMsg(_('No more orders can be placed by') . ' ' . $myrow[0] . ' ' . _(' their account is currently at or over their credit limit'),'warn'); - include('includes/footer.inc'); - exit; - } - } - - } else { - prnMsg(_('The') . ' ' . $myrow[0] . ' ' . _('account is currently on hold please contact the credit control personnel to discuss'),'warn'); - } - -} elseif (!$_SESSION['Items'.$identifier]->DefaultSalesType OR $_SESSION['Items'.$identifier]->DefaultSalesType=='') { - -#Possible that the check to ensure this account is not on hold has not been done -#if the customer is placing own order, if this is the case then -#DefaultSalesType will not have been set as above - - $sql = "SELECT debtorsmaster.name, - holdreasons.dissallowinvoices, - debtorsmaster.salestype, - debtorsmaster.currcode, - debtorsmaster.customerpoline - FROM debtorsmaster, holdreasons - WHERE debtorsmaster.holdreason=holdreasons.reasoncode - AND debtorsmaster.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; - - if (isset($_POST['Select'])) { - $ErrMsg = _('The details for the customer selected') . ': ' . $_POST['Select'] . ' ' . _('cannot be retrieved because'); - } else { - $ErrMsg = ''; - } - $DbgMsg = _('SQL used to retrieve the customer details was') . ':<br>' . $sql; - $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); - - $myrow = DB_fetch_row($result); - if ($myrow[1] == 0){ - - $_SESSION['Items'.$identifier]->CustomerName = $myrow[0]; - -# the sales type determines the price list to be used by default the customer of the user is -# defaulted from the entry of the userid and password. - - $_SESSION['Items'.$identifier]->DefaultSalesType = $myrow[2]; - $_SESSION['Items'.$identifier]->DefaultCurrency = $myrow[3]; - $_SESSION['Items'.$identifier]->Branch = $_SESSION['UserBranch']; - $_SESSION['Items'.$identifier]->DefaultPOLine = $myrow[4]; - - - // the branch would be set in the user data so default delivery details as necessary. However, - // the order process will ask for branch details later anyway - - $sql = "SELECT custbranch.brname, - custbranch.braddress1, - custbranch.braddress2, - custbranch.braddress3, - custbranch.braddress4, - custbranch.braddress5, - custbranch.braddress6, - custbranch.phoneno, - custbranch.email, - custbranch.defaultlocation, - custbranch.deliverblind, - custbranch.estdeliverydays, - locations.locationname - FROM custbranch INNER JOIN locations - ON custbranch.defaultlocation=locations.loccode - WHERE custbranch.branchcode='" . $_SESSION['Items'.$identifier]->Branch . "' - AND custbranch.debtorno = '" . $_SESSION['Items'.$identifier]->DebtorNo . "'"; - - if (isset($_POST['Select'])) { - $ErrMsg = _('The customer branch record of the customer selected') . ': ' . $_POST['Select'] . ' ' . _('cannot be retrieved because'); - } else { - $ErrMsg = ''; - } - $DbgMsg = _('SQL used to retrieve the branch details was'); - $result =DB_query($sql,$db,$ErrMsg, $DbgMsg); - - $myrow = DB_fetch_row($result); - $_SESSION['Items'.$identifier]->DeliverTo = $myrow[0]; - $_SESSION['Items'.$identifier]->DelAdd1 = $myrow[1]; - $_SESSION['Items'.$identifier]->DelAdd2 = $myrow[2]; - $_SESSION['Items'.$identifier]->DelAdd3 = $myrow[3]; - $_SESSION['Items'.$identifier]->DelAdd4 = $myrow[4]; - $_SESSION['Items'.$identifier]->DelAdd5 = $myrow[5]; - $_SESSION['Items'.$identifier]->DelAdd6 = $myrow[6]; - $_SESSION['Items'.$identifier]->PhoneNo = $myrow[7]; - $_SESSION['Items'.$identifier]->Email = $myrow[8]; - $_SESSION['Items'.$identifier]->Location = $myrow[9]; - $_SESSION['Items'.$identifier]->DeliverBlind = $myrow[10]; - $_SESSION['Items'.$identifier]->DeliveryDays = $myrow[11]; - $_SESSION['Items'.$identifier]->LocationName = $myrow[12]; - } else { - prnMsg(_('Sorry, your account has been put on hold for some reason, please contact the credit control personnel.'),'warn'); - include('includes/footer.inc'); - exit; - } -} - -if ($_SESSION['RequireCustomerSelection'] ==1 - OR !isset($_SESSION['Items'.$identifier]->DebtorNo) - OR $_SESSION['Items'.$identifier]->DebtorNo=='') { - - - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . - ' ' . _('Enter an Order or Quotation') . ' : ' . _('Search for the Customer Branch.') . '</p>'; - echo '<div class="page_help_text">' . _('Orders/Quotations are placed against the Customer Branch. A Customer may have several Branches.') . '</div>'; - ?> - <form action="<?php echo $_SERVER['PHP_SELF'] . '?' .SID .'identifier='.$identifier;?>" name="SelectCustomer" method=post> - <b><?php echo '<p>' . $msg; ?></p> - <table cellpadding=3 colspan=4> - <tr> - <td><h5><?php echo _('Part of the Customer Branch Name'); ?>:</h5></td> - <td><input tabindex=1 type="Text" name="CustKeywords" size=20 maxlength=25></td> - <td><h2><b><?php echo _('OR'); ?></b></h2></td> - <td><h5><?php echo _('Part of the Customer Branch Code'); ?>:</h5></td> - <td><input tabindex=2 type="Text" name="CustCode" size=15 maxlength=18></td> - <td><h2><b><?php echo _('OR'); ?></b></h2></td> - <td><h5><?php echo _('Part of the Branch Phone Number'); ?>:</h5></td> - <td><input tabindex=3 type="Text" name="CustPhone" size=15 maxlength=18></td> - </tr> - </table> - <br><div class="centre"><input tabindex=4 type=submit name="SearchCust" value="<?php echo _('Search Now'); ?>"> - <input tabindex=5 type=submit action=reset value="<?php echo _('Reset'); ?>"></div> - <?php - - if (isset($result_CustSelect)) { - - echo '<table cellpadding=2 colspan=7 border=2>'; - - $TableHeader = '<br><tr> - <th>' . _('Code') . '</th> - <th>' . _('Branch') . '</th> - <th>' . _('Contact') . '</th> - <th>' . _('Phone') . '</th> - <th>' . _('Fax') . '</th> - </tr>'; - echo $TableHeader; - - $j = 1; - $k = 0; //row counter to determine background colour - - while ($myrow=DB_fetch_array($result_CustSelect)) { - - if ($k==1){ - echo '<tr class="EvenTableRows">'; - $k=0; - } else { - echo '<tr class="OddTableRows">'; - $k=1; - } - - printf('<td><input tabindex='.number_format($j+5).' type=submit name="Select" value="%s - %s"</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - <td>%s</td> - </tr>', - $myrow['debtorno'], - $myrow['branchcode'], - $myrow['brname'], - $myrow['contactname'], - $myrow['phoneno'], - $myrow['faxno']); - - $j++; -//end of page full new headings if - } -//end of while loop - - echo '</table>'; - - }//end if results to show - -//end if RequireCustomerSelection -} else { //dont require customer selection -// everything below here only do if a customer is selected - - if (isset($_POST['CancelOrder'])) { - $OK_to_delete=1; //assume this in the first instance - - if($_SESSION['ExistingOrder']!=0) { //need to check that not already dispatched - - $sql = 'SELECT qtyinvoiced - FROM salesorderdetails - WHERE orderno=' . $_SESSION['ExistingOrder'] . ' - AND qtyinvoiced>0'; - - $InvQties = DB_query($sql,$db); - - if (DB_num_rows($InvQties)>0){ - - $OK_to_delete=0; - - prnMsg( _('There are lines on this order that have already been invoiced. Please delete only the lines on the order that are no longer required') . '<p>' . _('There is an option on confirming a dispatch/invoice to automatically cancel any balance on the order at the time of invoicing if you know the customer will not want the back order'),'warn'); - } - } - - if ($OK_to_delete==1){ - if($_SESSION['ExistingOrder']!=0){ - - $SQL = 'DELETE FROM salesorderdetails WHERE salesorderdetails.orderno =' . $_SESSION['ExistingOrder']; - $ErrMsg =_('The order detail lines could not be deleted because'); - $DelResult=DB_query($SQL,$db,$ErrMsg); - - $SQL = 'DELETE FROM salesorders WHERE salesorders.orderno=' . $_SESSION['ExistingOrder']; - $ErrMsg = _('The order header could not be deleted because'); - $DelResult=DB_query($SQL,$db,$ErrMsg); - - $_SESSION['ExistingOrder']=0; - } - - unset($_SESSION['Items'.$identifier]->LineItems); - $_SESSION['Items'.$identifier]->ItemsOrdered=0; - unset($_SESSION['Items'.$identifier]); - $_SESSION['Items'.$identifier] = new cart; - - if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ - $_SESSION['RequireCustomerSelection'] = 1; - } else { - $_SESSION['RequireCustomerSelection'] = 0; - } - echo '<br><br>'; - prnMsg(_('This sales order has been cancelled as requested'),'success'); - include('includes/footer.inc'); - exit; - } - } else { /*Not cancelling the order */ - - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/inventory.png" title="' . _('Order') . '" alt="">' . ' '; - - if ($_SESSION['Items'.$identifier]->Quotation==1){ - echo _('Quotation for') . ' '; - } else { - echo _('Order for') . ' '; - } - - echo _('Customer') . ':<b> ' . $_SESSION['Items'.$identifier]->DebtorNo; - echo '</b> ' . _('Customer Name') . ': ' . $_SESSION['Items'.$identifier]->CustomerName; - echo '</b><div class="page_help_text">' . '<b>' . _('Default Options (can be modified during order):') . '</b><br>' . _('Deliver To') . ':<b> ' . $_SESSION['Items'.$identifier]->DeliverTo; - echo '</b> ' . _('From Location') . ':<b> ' . $_SESSION['Items'.$identifier]->LocationName; - echo '</b><br>' . _('Sales Type') . '/' . _('Price List') . ':<b> ' . $_SESSION['Items'.$identifier]->SalesTypeName; - echo '</b><br>' . _('Terms') . ':<b> ' . $_SESSION['Items'.$identifier]->PaymentTerms; - echo '</b></div>'; - } - - if (isset($_POST['Search']) or isset($_POST['Next']) or isset($_POST['Prev'])){ - - if ($_POST['Keywords']!=='' AND $_POST['StockCode']=='') { - $msg='</b><div class="page_help_text">' . _('Order Item description has been used in search') . '.</div>'; - } elseif ($_POST['StockCode']!=='' AND $_POST['Keywords']=='') { - $msg='</b><div class="page_help_text">' . _('Stock Code has been used in search') . '.</div>'; - } elseif ($_POST['Keywords']=='' AND $_POST['StockCode']=='') { - $msg='</b><div class="page_help_text">' . _('Stock Category has been used in search') . '.</div>'; - } - if (isset($_POST['Keywords']) AND strlen($_POST['Keywords'])>0) { - //insert wildcard characters in spaces - $_POST['Keywords'] = strtoupper($_POST['Keywords']); - - $i=0; - $SearchString = '%'; - while (strpos($_POST['Keywords'], ' ', $i)) { - $wrdlen=strpos($_POST['Keywords'],' ',$i) - $i; - $SearchString=$SearchString . substr($_POST['Keywords'],$i,$wrdlen) . '%'; - $i=strpos($_POST['Keywords'],' ',$i) +1; - } - $SearchString = $SearchString. substr($_POST['Keywords'],$i).'%'; - - 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.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.discontinued=0 - AND stockmaster.description " . LIKE . " '" . $SearchString . "' - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; - } - - } elseif (strlen($_POST['StockCode'])>0){ - - $_POST['StockCode'] = strtoupper($_POST['StockCode']); - $SearchString = '%' . $_POST['StockCode'] . '%'; - - 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.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.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.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.discontinued=0 - AND stockmaster.categoryid='" . $_POST['StockCat'] . "' - ORDER BY stockmaster.stockid"; - } - } - - if (isset($_POST['Next'])) { - $Offset = $_POST['nextlist']; - } - if (isset($_POST['Prev'])) { - $Offset = $_POST['previous']; - } - if (!isset($Offset) or $Offset<0) { - $Offset=0; - } - $SQL = $SQL . ' LIMIT ' . $_SESSION['DisplayRecordsMax'].' OFFSET '.number_format($_SESSION['DisplayRecordsMax']*$Offset); - - $ErrMsg = _('There is a problem selecting the part records to display because'); - $DbgMsg = _('The SQL used to get the part selection was'); - $SearchResult = DB_query($SQL,$db,$ErrMsg, $DbgMsg); - - if (DB_num_rows($SearchResult)==0 ){ - prnMsg (_('There are no products available meeting the criteria specified'),'info'); - -// if ($debug==1){ -// prnMsg(_('The SQL statement used was') . ':<br>' . $SQL,'info'); -// } - } - if (DB_num_rows($SearchResult)==1){ - $myrow=DB_fetch_array($SearchResult); - $NewItem = $myrow['stockid']; - DB_data_seek($SearchResult,0); - } - if (DB_num_rows($SearchResult)<$_SESSION['DisplayRecordsMax']){ - $Offset=0; - } - - } //end of if search - -#Always do the stuff below if not looking for a customerid - - echo '<form action="' . $_SERVER['PHP_SELF'] . '?' . SID .'identifier='.$identifier . '"& name="SelectParts" method=post>'; - - /*Process Quick Entry */ - - if (isset($_POST['order_items']) or isset($_POST['QuickEntry']) or isset($_POST['Recalculate'])){ // if enter is pressed on the quick entry screen, the default button may be Recalculate - /* get the item details from the database and hold them in the cart object */ - - /*Discount can only be set later on -- after quick entry -- so default discount to 0 in the first place */ - $Discount = 0; - - $i=1; - while ($i<=$_SESSION['QuickEntries'] and isset($_POST['part_' . $i]) and $_POST['part_' . $i]!='') { - $QuickEntryCode = 'part_' . $i; - $QuickEntryQty = 'qty_' . $i; - $QuickEntryPOLine = 'poline_' . $i; - $QuickEntryItemDue = 'itemdue_' . $i; - - $i++; - - if (isset($_POST[$QuickEntryCode])) { - $NewItem = strtoupper($_POST[$QuickEntryCode]); - } - if (isset($_POST[$QuickEntryQty])) { - $NewItemQty = $_POST[$QuickEntryQty]; - } - if (isset($_POST[$QuickEntryCode])) { - $NewItemDue = $_POST[$QuickEntryItemDue]; - } else { - $NewItemDue = DateAdd (Date($_SESSION['DefaultDateFormat']),'d', $_SESSION['Items'.$identifier]->DeliveryDays); - } - if (isset($_POST[$QuickEntryPOLine])) { - $NewPOLine = $_POST[$QuickEntryPOLine]; - } else { - $NewPOLine = 0; - } - - if (!isset($NewItem)){ - unset($NewItem); - break; /* break out of the loop if nothing in the quick entry fields*/ - } - - if(!Is_Date($NewItemDue)) { - prnMsg(_('An invalid date entry was made for ') . ' ' . $NewItem . ' ' . _('The date entry') . ' ' . $NewItemDue . ' ' . _('must be in the format') . ' ' . $_SESSION['DefaultDateFormat'],'warn'); - //Attempt to default the due date to something sensible? - $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 - 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 '); - $KitResult = DB_query($sql, $db,$ErrMsg,$DbgMsg); - - - if (DB_num_rows($KitResult)==0){ - prnMsg( _('The item code') . ' ' . $NewItem . ' ' . _('could not be retrieved from the database and has not been added to the order'),'warn'); - } 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') . "'"; - - $ErrMsg = _('Could not retrieve kitset components from the database because') . ' '; - $KitResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); - - $ParentQty = $NewItemQty; - while ($KitParts = DB_fetch_array($KitResult,$db)){ - $NewItem = $KitParts['component']; - $NewItemQty = $KitParts['quantity'] * $ParentQty; - $NewItemDue = date($_SESSION['DefaultDateFormat']); - $NewPOLine = 0; - include('includes/SelectOrderItems_IntoCart.inc'); - } - - } elseif ($myrow['mbflag']=='G'){ - prnMsg(_('Phantom assemblies cannot be sold, these items exist only as bills of materials used in other manufactured items. The following item has not been added to the order:') . ' ' . $NewItem, 'warn'); - } else { /*Its not a kit set item*/ - $NewItemDue = date($_SESSION['DefaultDateFormat']); - $NewPOLine = 0; - include('includes/SelectOrderItems_IntoCart.inc'); - } - } - } - unset($NewItem); - } /* end of if quick entry */ - - - /*Now do non-quick entry delete/edits/adds */ - - if ((isset($_SESSION['Items'.$identifier])) OR isset($NewItem)){ - - if(isset($_GET['Delete'])){ - //page called attempting to delete a line - GET['Delete'] = the line number to delete - if($_SESSION['Items'.$identifier]->Some_Already_Delivered($_GET['Delete'])==0){ - $_SESSION['Items'.$identifier]->remove_from_cart($_GET['Delete'], 'Yes'); /*Do update DB */ - } else { - prnMsg( _('This item cannot be deleted because some of it has already been invoiced'),'warn'); - } - } - - foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { - - if (isset($_POST['Quantity_' . $OrderLine->LineNumber])){ - - $Quantity = $_POST['Quantity_' . $OrderLine->LineNumber]; - - if ($OrderLine->Price == $_POST['Price_' . $OrderLine->LineNumber] - AND ABS($OrderLine->DiscountPercent - ($_POST['Discount_' . $OrderLine->LineNumber]/100)) < 0.001 - AND is_numeric($_POST['GPPercent_' . $OrderLine->LineNumber]) - AND $_POST['GPPercent_' . $OrderLine->LineNumber]<100 - AND $_POST['GPPercent_' . $OrderLine->LineNumber]>0) { - - if ($_SESSION['Items'.$identifier]->DefaultCurrency != $_SESSION['CompanyRecord']['currencydefault']){ - $ExRateResult = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['Items'.$identifier]->DefaultCurrency . "'",$db); - if (DB_num_rows($ExRateResult)>0){ - $ExRateRow = DB_fetch_row($ExRateResult); - $ExRate = $ExRateRow[0]; - } else { - $ExRate =1; - } - } else { - $ExRate = 1; - } - $Price = round(($OrderLine->StandardCost*$ExRate)/(1 -(($_POST['GPPercent_' . $OrderLine->LineNumber]+$_POST['Discount_' . $OrderLine->LineNumber])/100)),3); - - } else { - $Price = $_POST['Price_' . $OrderLine->LineNumber]; - } - $DiscountPercentage = $_POST['Discount_' . $OrderLine->LineNumber]; - if ($_SESSION['AllowOrderLineItemNarrative'] == 1) { - $Narrative = $_POST['Narrative_' . $OrderLine->LineNumber]; - } else { - $Narrative = ''; - } - $ItemDue = $_POST['ItemDue_' . $OrderLine->LineNumber]; - $POLine = $_POST['POLine_' . $OrderLine->LineNumber]; - - if (!isset($OrderLine->DiscountPercent)) { - $OrderLine->DiscountPercent = 0; - } - - if(!Is_Date($ItemDue)) { - prnMsg(_('An invalid date entry was made for ') . ' ' . $NewItem . ' ' . _('The date entry') . ' ' . $ItemDue . ' ' . _('must be in the format') . ' ' . $_SESSION['DefaultDateFormat'],'warn'); - //Attempt to default the due date to something sensible? - $ItemDue = DateAdd (Date($_SESSION['DefaultDateFormat']),'d', $_SESSION['Items'.$identifier]->DeliveryDays); - } - if ($Quantity<0 OR $Price <0 OR $DiscountPercentage >100 OR $DiscountPercentage <0){ - prnMsg(_('The item could not be updated because you are attempting to set the quantity ordered to less than 0 or the price less than 0 or the discount more than 100% or less than 0%'),'warn'); - - } elseif($_SESSION['Items'.$identifier]->Some_Already_Delivered($OrderLine->LineNumber)!=0 AND $_SESSION['Items'.$identifier]->LineItems[$OrderLine->LineNumber]->Price != $Price) { - - prnMsg(_('The item you attempting to modify the price for has already had some quantity invoiced at the old price the items unit price cannot be modified retrospectively'),'warn'); - - } elseif($_SESSION['Items'.$identifier]->Some_Already_Delivered($OrderLine->LineNumber)!=0 AND $_SESSION['Items'.$identifier]->LineItems[$OrderLine->LineNumber]->DiscountPercent != ($DiscountPercentage/100)) { - - prnMsg(_('The item you attempting to modify has had some quantity invoiced at the old discount percent the items discount cannot be modified retrospectively'),'warn'); - - } elseif ($_SESSION['Items'.$identifier]->LineItems[$OrderLine->LineNumber]->QtyInv > $Quantity){ - prnMsg( _('You are attempting to make the quantity ordered a quantity less than has already been invoiced') . '. ' . _('The quantity delivered and invoiced cannot be modified retrospectively'),'warn'); - } elseif ($OrderLine->Quantity !=$Quantity OR $OrderLine->Price != $Price OR ABS($OrderLine->DiscountPercent -$DiscountPercentage/100) >0.001 OR $OrderLine->Narrative != $Narrative OR $OrderLine->ItemDue != $ItemDue OR $OrderLine->POLine != $POLine) { - $_SESSION['Items'.$identifier]->update_cart_item($OrderLine->LineNumber, - $Quantity, - $Price, - ($DiscountPercentage/100), - $Narrative, - 'Yes', /*Update DB */ - $ItemDue, /*added line 8/23/2007 by Morris Kelly to get line item due date*/ - $POLine); - } - } //page not called from itself - POST variables not set - } - } - if (isset($_POST['DeliveryDetails'])){ - echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/DeliveryDetails.php?' . SID .'identifier='.$identifier . '">'; - prnMsg(_('You should automatically be forwarded to the entry of the delivery details page') . '. ' . _('if this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . - '<a href="' . $rootpath . '/DeliveryDetails.php?' . SID .'identifier='.$identifier . '">' . _('click here') . '</a> ' . _('to continue'), 'info'); - exit; - } - - - if (isset($NewItem)){ -/* 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'*/ - $sql = "SELECT stockmaster.mbflag - FROM stockmaster - WHERE stockmaster.stockid='". $NewItem ."'"; - - $ErrMsg = _('Could not determine if the part being ordered was a kitset or not because'); - - $KitResult = DB_query($sql, $db,$ErrMsg); - - $NewItemQty = 1; /*By Default */ - $Discount = 0; /*By default - can change later or discount category override */ - - 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') . "'"; - - $ErrMsg = _('Could not retrieve kitset components from the database because'); - $KitResult = DB_query($sql,$db,$ErrMsg); - - $ParentQty = $NewItemQty; - while ($KitParts = DB_fetch_array($KitResult,$db)){ - $NewItem = $KitParts['component']; - $NewItemQty = $KitParts['quantity'] * $ParentQty; - $NewPOLine = 0; - $NewItemDue = date($_SESSION['DefaultDateFormat']); - include('includes/SelectOrderItems_IntoCart.inc'); - } - - } else { /*Its not a kit set item*/ - $NewItemDue = date($_SESSION['DefaultDateFormat']); - $NewPOLine = 0; - - include('includes/SelectOrderItems_IntoCart.inc'); - } - - } /* end of if its a new item */ - - } /*end of if its a new item */ - - if (isset($NewItem_array) && 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) { - if($NewItemQty > 0) { - $sql = "SELECT stockmaster.mbflag - FROM stockmaster - WHERE stockmaster.stockid='". $NewItem ."'"; - - $ErrMsg = _('Could not determine if the part being ordered was a kitset or not because'); - - $KitResult = DB_query($sql, $db,$ErrMsg); - - //$NewItemQty = 1; /*By Default */ - $Discount = 0; /*By default - can change later or discount category override */ - - 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') . "'"; - - $ErrMsg = _('Could not retrieve kitset components from the database because'); - $KitResult = DB_query($sql,$db,$ErrMsg); - - $ParentQty = $NewItemQty; - while ($KitParts = DB_fetch_array($KitResult,$db)){ - $NewItem = $KitParts['component']; - $NewItemQty = $KitParts['quantity'] * $ParentQty; - $NewItemDue = date($_SESSION['DefaultDateFormat']); - $NewPOLine = 0; - include('includes/SelectOrderItems_IntoCart.inc'); - } - - } else { /*Its not a kit set item*/ - $NewItemDue = date($_SESSION['DefaultDateFormat']); - $NewPOLine = 0; - - include('includes/SelectOrderItems_IntoCart.inc'); - } - - } /* end of if its a new item */ - - } /*end of if its a new item */ - - } - - } - - - /* Run through each line of the order and work out the appropriate discount from the discount matrix */ - $DiscCatsDone = array(); - $counter =0; - foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { - - if ($OrderLine->DiscCat !="" AND ! in_array($OrderLine->DiscCat,$DiscCatsDone)){ - $DiscCatsDone[$counter]=$OrderLine->DiscCat; - $QuantityOfDiscCat =0; - - foreach ($_SESSION['Items'.$identifier]->LineItems as $StkItems_2) { - /* add up total quantity of all lines of this DiscCat */ - if ($StkItems_2->DiscCat==$OrderLine->DiscCat){ - $QuantityOfDiscCat += $StkItems_2->Quantity; - } - } - $result = DB_query("SELECT MAX(discountrate) AS discount - 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) { - /* add up total quantity of all lines of this DiscCat */ - if ($StkItems_2->DiscCat==$OrderLine->DiscCat AND $StkItems_2->DiscountPercent == 0){ - $_SESSION['Items'.$identifier]->LineItems[$StkItems_2->LineNumber]->DiscountPercent = $myrow[0]; - } - } - } - } - } /* end of discount matrix lookup code */ - - if (count($_SESSION['Items'.$identifier]->LineItems)>0){ /*only show order lines if there are any */ - -/* This is where the order as selected should be displayed reflecting any deletions or insertions*/ - - echo '<br> - <table width="90%" cellpadding="2" colspan="7" border="1"> - <tr bgcolor=#800000>'; - if($_SESSION['Items'.$identifier]->DefaultPOLine == 1){ - echo '<th>' . _('PO Line') . '</th>'; - } - echo '<div class="page_help_text">' . _('Quantity (required) - Enter the number of units ordered. Price (required) - Enter the unit price. Discount (optional) - Enter a percentage discount. GP% (optional) - Enter a percentage Gross Profit (GP) to add to the unit cost. Due Date (optional) - Enter a date for delivery.') . '</div><br>'; - echo '<th>' . _('Item Code') . '</th> - <th>' . _('Item Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('QOH') . '</th> - <th>' . _('Unit') . '</th> - <th>' . _('Price') . '</th>'; - if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ - echo '<th>' . _('Discount') . '</th> - <th>' . _('GP %') . '</th>'; - if (!isset($ExRate)){ - if ($_SESSION['Items'.$identifier]->DefaultCurrency != $_SESSION['CompanyRecord']['currencydefault']){ - $ExRateResult = DB_query("SELECT rate FROM currencies WHERE currabrev='" . $_SESSION['Items'.$identifier]->DefaultCurrency . "'",$db); - if (DB_num_rows($ExRateResult)>0){ - $ExRateRow = DB_fetch_row($ExRateResult); - $ExRate = $ExRateRow[0]; - } else { - $ExRate =1; - } - } else { - $ExRate = 1; - } - } - } - echo '<th>' . _('Total') . '</th> - <th>' . _('Due Date') . '</th></tr>'; - - $_SESSION['Items'.$identifier]->total = 0; - $_SESSION['Items'.$identifier]->totalVolume = 0; - $_SESSION['Items'.$identifier]->totalWeight = 0; - $k =0; //row colour counter - foreach ($_SESSION['Items'.$identifier]->LineItems as $OrderLine) { - if ($OrderLine->Price !=0){ - $GPPercent = (($OrderLine->Price * (1 - $OrderLine->DiscountPercent)) - ($OrderLine->StandardCost * $ExRate))*100/$OrderLine->Price; - } else { - $GPPercent = 0; - } - $LineTotal = $OrderLine->Quantity * $OrderLine->Price * (1 - $OrderLine->DiscountPercent); - $DisplayLineTotal = number_format($LineTotal,2); - $DisplayDiscount = number_format(($OrderLine->DiscountPercent * 100),2); - $QtyOrdered = $OrderLine->Quantity; - $QtyRemain = $QtyOrdered - $OrderLine->QtyInv; - - if ($OrderLine->QOHatLoc < $OrderLine->Quantity AND ($OrderLine->MBflag=='B' OR $OrderLine->MBflag=='M')) { - /*There is a stock deficiency in the stock location selected */ - $RowStarter = '<tr bgcolor="#EEAABB">'; - } elseif ($k==1){ - $RowStarter = '<tr class="OddTableRows">'; - $k=0; - } else { - $RowStarter = '<tr class="EvenTableRows">'; - $k=1; - } - - echo $RowStarter; - if($_SESSION['Items'.$identifier]->DefaultPOLine ==1){ //show the input field only if required - echo '<td><input tabindex=1 type=text name="POLine_' . $OrderLine->LineNumber . '" size=20 maxlength=20 value=' . $OrderLine->POLine . '></td>'; - } else { - echo '<input type="hidden" name="POLine_' . $OrderLine->LineNumber . '" value="">'; - } - - echo '<td><a target="_blank" href="' . $rootpath . '/StockStatus.php?' . SID .'identifier='.$identifier . '&StockID=' . $OrderLine->StockID . '&DebtorNo=' . $_SESSION['Items'.$identifier]->DebtorNo . '">' . $OrderLine->StockID . '</a></td> - <td>' . $OrderLine->ItemDescription . '</td>'; - - echo '<td><input class="number" onKeyPress="return restrictToNumbers(this, event)" tabindex=2 type=tect name="Quantity_' . $OrderLine->LineNumber . '" size=6 maxlength=6 value=' . $OrderLine->Quantity . '>'; - if ($QtyRemain != $QtyOrdered){ - echo '<br>'.$OrderLine->QtyInv.' of '.$OrderLine->Quantity.' invoiced'; - } - echo '</td> - <td class="number">' . $OrderLine->QOHatLoc . '</td> - <td>' . $OrderLine->Units . '</td>'; - - if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ - /*OK to display with discount if it is an internal user with appropriate permissions */ - - echo '<td><input class="number" onKeyPress="return restrictToNumbers(this, event)" type=text name="Price_' . $OrderLine->LineNumber . '" size=16 maxlength=16 value=' . $OrderLine->Price . '></td> - <td><input class="number" onKeyPress="return restrictToNumbers(this, event)" type=text name="Discount_' . $OrderLine->LineNumber . '" size=5 maxlength=4 value=' . ($OrderLine->DiscountPercent * 100) . '>%</td> - <td><input class="number" onKeyPress="return restrictToNumbers(this, event)" type=text name="GPPercent_' . $OrderLine->LineNumber . '" size=5 maxlength=4 value=' . $GPPercent . '>%</td>'; - - } else { - echo '<td align=right>' . $OrderLine->Price . '</td><td></td>'; - echo '<input type=hidden name="Price_' . $OrderLine->LineNumber . '" value=' . $OrderLine->Price . '>'; - } - if ($_SESSION['Items'.$identifier]->Some_Already_Delivered($OrderLine->LineNumber)){ - $RemTxt = _('Clear Remaining'); - } else { - $RemTxt = _('Delete'); - } - echo '</td><td class=number>' . $DisplayLineTotal . '</td>'; - $LineDueDate = $OrderLine->ItemDue; - if (!Is_Date($OrderLine->ItemDue)){ - $LineDueDate = DateAdd (Date($_SESSION['DefaultDateFormat']),'d', $_SESSION['Items'.$identifier]->DeliveryDays); - $_SESSION['Items'.$identifier]->LineItems[$OrderLine->LineNumber]->ItemDue= $LineDueDate; - } - - echo '<td><input type=text class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ItemDue_' . $OrderLine->LineNumber . '" size=10 maxlength=10 value=' . $LineDueDate . '></td>'; - - echo '<td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID .'identifier='.$identifier . '&Delete=' . $OrderLine->LineNumber . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">' . $RemTxt . '</a></td></tr>'; - - if ($_SESSION['AllowOrderLineItemNarrative'] == 1){ - echo $RowStarter; - echo '<td colspan=10>' . _('Narrative') . ':<textarea name="Narrative_' . $OrderLine->LineNumber . '" cols="200" rows="1">' . stripslashes(AddCarriageReturns($OrderLine->Narrative)) . '</textarea><br></td></tr>'; - } else { - echo '<input type=hidden name="Narrative" value="">'; - } - - $_SESSION['Items'.$identifier]->total = $_SESSION['Items'.$identifier]->total + $LineTotal; - $_SESSION['Items'.$identifier]->totalVolume = $_SESSION['Items'.$identifier]->totalVolume + $OrderLine->Quantity * $OrderLine->Volume; - $_SESSION['Items'.$identifier]->totalWeight = $_SESSION['Items'.$identifier]->totalWeight + $OrderLine->Quantity * $OrderLine->Weight; - - } /* end of loop around items */ - - $DisplayTotal = number_format($_SESSION['Items'.$identifier]->total,2); - if (in_array(2,$_SESSION['AllowedPageSecurityTokens'])){ - $ColSpanNumber = 7; - } else { - $ColSpanNumber = 5; - } - echo '<tr><td></td><td><b>' . _('TOTAL Excl Tax/Freight') . '</b></td> - <td colspan="' . $ColSpanNumber . '" 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><td>' . _('Total Weight') . ':</td> - <td>' . $DisplayWeight . '</td> - <td>' . _('Total Volume') . ':</td> - <td>' . $DisplayVolume . '</td> - </tr></table>'; - - - echo '<br><div class="centre"><input type=submit name="Recalculate" Value="' . _('Re-Calculate') . '"> - <input type=submit name="DeliveryDetails" value="' . _('Enter Delivery Details and Confirm Order') . '"></div><hr>'; - - } # end of if lines - -/* Now show the stock item selection search stuff below */ - - if (isset($_POST['PartSearch']) && $_POST['PartSearch']!='' || !isset($_POST['QuickEntry'])){ - - echo '<input type="hidden" name="PartSearch" value="' . _('Yes Please') . '">'; - - $SQL="SELECT categoryid, - categorydescription - FROM stockcategory - WHERE stocktype='F' OR stocktype='D' - ORDER BY categorydescription"; - $result1 = DB_query($SQL,$db); -// Select the most recently ordered items for quick select - $SQL="SELECT stockmaster.units, stockmaster.description, stockmaster.stockid, salesorderdetails.stkcode, SUM(qtyinvoiced) Sales FROM `salesorderdetails`, `stockmaster` - WHERE ActualDispatchDate >= DATE_SUB(CURDATE(), INTERVAL 180 DAY) - AND salesorderdetails.stkcode = stockmaster.stockid - GROUP BY stkcode - ORDER BY sales DESC - LIMIT 5;"; - $result2 = DB_query($SQL,$db); - echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/magnifier.png" title="' . _('Search') . '" alt="">' . ' '; - echo _('Frequently Ordered Items') . '<br>'; - echo '<div class="page_help_text">' . _('Frequently Ordered Items') . _(', shows Top 5 most ordered items in the last 6 months. You can choose from this list, or search further for other items') . '.</div><br>'; - echo '<table class="table1">'; - $TableHeader = '<tr><th>' . _('Code') . '</th> - <th>' . _('Description') . '</th> - <th>' . _('Units') . '</th> - <th>' . _('On Hand') . '</th> - <th>' . _('On Demand') . '</th> - <th>' . _('On Order') . '</th> - <th>' . _('Available') . '</th> - <th>' . _('Quantity') . '</th></tr>'; - echo $TableHeader; - $j = 1; - $k=0; //row colour counter - - ... [truncated message content] |
From: <tim...@us...> - 2009-11-03 15:47:33
|
Revision: 2684 http://web-erp.svn.sourceforge.net/web-erp/?rev=2684&view=rev Author: tim_schofield Date: 2009-11-03 15:47:26 +0000 (Tue, 03 Nov 2009) Log Message: ----------- New fixed asset files from Tim Schofield Added Paths: ----------- trunk/FixedAssetCategories.php trunk/FixedAssetItems.php trunk/FixedAssetJournal.php trunk/FixedAssetLocations.php trunk/FixedAssetRegister.php trunk/FixedAssetTransfer.php Added: trunk/FixedAssetCategories.php =================================================================== --- trunk/FixedAssetCategories.php (rev 0) +++ trunk/FixedAssetCategories.php 2009-11-03 15:47:26 UTC (rev 2684) @@ -0,0 +1,466 @@ +<?php +/* $Revision: 1.2 $ */ + +$PageSecurity = 11; + +include('includes/session.inc'); + +$title = _('Fixed Asset Category Maintenance'); + +include('includes/header.inc'); + +if (isset($_GET['SelectedCategory'])){ + $SelectedCategory = strtoupper($_GET['SelectedCategory']); +} else if (isset($_POST['SelectedCategory'])){ + $SelectedCategory = strtoupper($_POST['SelectedCategory']); +} + +if (isset($_GET['DeleteProperty'])){ + + $ErrMsg = _('Could not delete the property') . ' ' . $_GET['DeleteProperty'] . ' ' . _('because'); + $sql = "DELETE FROM stockitemproperties WHERE stkcatpropid=" . $_GET['DeleteProperty']; + $result = DB_query($sql,$db,$ErrMsg); + $sql = "DELETE FROM stockcatproperties WHERE stkcatpropid=" . $_GET['DeleteProperty']; + $result = DB_query($sql,$db,$ErrMsg); + prnMsg(_('Deleted the property') . ' ' . $_GET['DeleteProperty'],'success'); +} + +if (isset($_POST['submit'])) { + + //initialise no input errors assumed initially before we test + $InputError = 0; + + /* actions to take once the user has clicked the submit button + ie the page has called itself with some user input */ + + //first off validate inputs sensible + + $_POST['CategoryID'] = strtoupper($_POST['CategoryID']); + + if (strlen($_POST['CategoryID']) > 6) { + $InputError = 1; + prnMsg(_('The Fixed Asset Category code must be six characters or less long'),'error'); + } elseif (strlen($_POST['CategoryID'])==0) { + $InputError = 1; + prnMsg(_('The Fixed Asset Category code must be at least 1 character but less than six characters long'),'error'); + } elseif (strlen($_POST['CategoryDescription']) >20) { + $InputError = 1; + prnMsg(_('The Fixed Asset Category description must be twenty characters or less long'),'error'); + } + + if ($SelectedCategory AND $InputError !=1) { + + /*SelectedCategory could also exist if submit had not been clicked this code + would not run in this case cos submit is false of course see the + delete code below*/ + + $sql = "UPDATE stockcategory SET + stocktype = '" . $_POST['StockType'] . "', + categorydescription = '" . $_POST['CategoryDescription'] . "', + stockact = " . $_POST['StockAct'] . ", + adjglact = " . $_POST['AdjGLAct'] . ", + materialuseagevarac = " . $_POST['MaterialUseageVarAc'] . ", + wipact = " . $_POST['WIPAct'] . " + WHERE + categoryid = '$SelectedCategory'"; + $ErrMsg = _('Could not update the fixed asset category') . $_POST['CategoryDescription'] . _('because'); + $result = DB_query($sql,$db,$ErrMsg); + +/* for ($i=0;$i<=$_POST['PropertyCounter'];$i++){ + + if (isset($_POST['PropReqSO' .$i]) and $_POST['PropReqSO' .$i] == true){ + $_POST['PropReqSO' .$i] =1; + } else { + $_POST['PropReqSO' .$i] =0; + } + if ($_POST['PropID' .$i] =='NewProperty' AND strlen($_POST['PropLabel'.$i])>0){ + $sql = "INSERT INTO stockcatproperties (categoryid, + label, + controltype, + defaultvalue, + reqatsalesorder) + VALUES ('" . $SelectedCategory . "', + '" . $_POST['PropLabel' . $i] . "', + " . $_POST['PropControlType' . $i] . ", + '" . $_POST['PropDefault' .$i] . "', + " . $_POST['PropReqSO' .$i] . ')'; + $ErrMsg = _('Could not insert a new category property for') . $_POST['PropLabel' . $i]; + $result = DB_query($sql,$db,$ErrMsg); + } elseif ($_POST['PropID' .$i] !='NewProperty') { //we could be amending existing properties + $sql = "UPDATE stockcatproperties SET label ='" . $_POST['PropLabel' . $i] . "', + controltype = " . $_POST['PropControlType' . $i] . ", + defaultvalue = '" . $_POST['PropDefault' .$i] . "', + reqatsalesorder = " . $_POST['PropReqSO' .$i] . " + WHERE stkcatpropid =" . $_POST['PropID' .$i]; + $ErrMsg = _('Updated the asset category property for') . ' ' . $_POST['PropLabel' . $i]; + $result = DB_query($sql,$db,$ErrMsg); + } + + } //end of loop round properties +*/ + prnMsg(_('Updated the fixed asset category record for') . ' ' . $_POST['CategoryDescription'],'success'); + + } elseif ($InputError !=1) { + + /*Selected category is null cos no item selected on first time round so must be adding a record must be submitting new entries in the new asset category form */ + + $sql = "INSERT INTO stockcategory (categoryid, + stocktype, + categorydescription, + stockact, + adjglact, + materialuseagevarac, + wipact) + VALUES ( + '" . $_POST['CategoryID'] . "', + '" . $_POST['StockType'] . "', + '" . $_POST['CategoryDescription'] . "', + " . $_POST['StockAct'] . ", + " . $_POST['AdjGLAct'] . ", + " . $_POST['MaterialUseageVarAc'] . ", + " . $_POST['WIPAct'] . ")"; + $ErrMsg = _('Could not insert the new asset category') . $_POST['CategoryDescription'] . _('because'); + $result = DB_query($sql,$db,$ErrMsg); + prnMsg(_('A new asset category record has been added for') . ' ' . $_POST['CategoryDescription'],'success'); + $sql="INSERT INTO stockcatproperties + VALUES( + NULL, + '".$_POST['CategoryID']."', + '"._('Depreciation Type')."', + '1', + '"._('Straight Line').","._('Reducing Balance')."', + '0')"; + $result=DB_query($sql,$db); + $sql="INSERT INTO stockcatproperties + VALUES( + NULL, + '".$_POST['CategoryID']."', + '"._('Annual Depreciation Percentage')."', + '0', + '5', + '0')"; + $result=DB_query($sql,$db); + $sql="INSERT INTO stockcatproperties + VALUES( + NULL, + '".$_POST['CategoryID']."', + '"._('Annual Internal Depreciation Percentage')."', + '0', + '5', + '0')"; + $result=DB_query($sql,$db); + } + //run the SQL from either of the above possibilites + + unset($_POST['StockType']); + unset($_POST['CategoryDescription']); + unset($_POST['StockAct']); + unset($_POST['AdjGLAct']); + unset($_POST['PurchPriceVarAct']); + unset($_POST['MaterialUseageVarAc']); + unset($_POST['WIPAct']); + + +} elseif (isset($_GET['delete'])) { +//the link to delete a selected record was clicked instead of the submit button + +// PREVENT DELETES IF DEPENDENT RECORDS IN 'StockMaster' + + $sql= "SELECT COUNT(*) FROM stockmaster WHERE stockmaster.categoryid='$SelectedCategory'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]>0) { + prnMsg(_('Cannot delete this asset category because stock items have been created using this asset category') . + '<br> ' . _('There are') . ' ' . $myrow[0] . ' ' . _('items referring to this asset category code'),'warn'); + + } else { + $sql = "SELECT COUNT(*) FROM salesglpostings WHERE stkcat='$SelectedCategory'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]>0) { + prnMsg(_('Cannot delete this asset category because it is used by the sales') . ' - ' . _('GL posting interface') . '. ' . _('Delete any records in the Sales GL Interface set up using this asset category first'),'warn'); + } else { + $sql = "SELECT COUNT(*) FROM cogsglpostings WHERE stkcat='$SelectedCategory'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]>0) { + prnMsg(_('Cannot delete this asset category because it is used by the cost of sales') . ' - ' . _('GL posting interface') . '. ' . _('Delete any records in the Cost of Sales GL Interface set up using this asset category first'),'warn'); + } else { + $sql="DELETE FROM stockcategory WHERE categoryid='$SelectedCategory'"; + $result = DB_query($sql,$db); + prnMsg(_('The asset category') . ' ' . $SelectedCategory . ' ' . _('has been deleted') . ' !','success'); + unset ($SelectedCategory); + } + } + } //end if asset category used in debtor transactions +} + +if (!isset($SelectedCategory)) { + +/* It could still be the second time the page has been run and a record has been selected for modification - SelectedCategory will exist because it was sent with the new call. If its the first time the page has been displayed with no parameters +then none of the above are true and the list of asset categorys will be displayed with +links to delete or edit each. These will call the same page again and allow update/input +or deletion of the records*/ + + $sql = "SELECT * FROM stockcategory WHERE stocktype='".'A'."'"; + $result = DB_query($sql,$db); + + echo "<br><table border=1>\n"; + echo '<tr><th>' . _('Cat Code') . '</th> + <th>' . _('Description') . '</th> + <th>' . _('Type') . '</th> + <th>' . _('Asset GL') . '</th> + <th>' . _('P & L Depn GL') . '</th> + <th>' . _('Sale of Asset account') . '</th> + <th>' . _('BS Depn GL') . '</th></tr>'; + + $k=0; //row colour counter + + while ($myrow = DB_fetch_row($result)) { + if ($k==1){ + echo '<tr class="EvenTableRows">'; + $k=0; + } else { + echo '<tr class="OddTableRows">'; + $k=1; + } + printf("<td>%s</td> + <td>%s</td> + <td>%s</td> + <td align=right>%s</td> + <td align=right>%s</td> + <td align=right>%s</td> + <td align=right>%s</td> + <td><a href=\"%sSelectedCategory=%s\">" . _('Edit') . "</td> + <td><a href=\"%sSelectedCategory=%s&delete=yes\" onclick=\"return confirm('" . _('Are you sure you wish to delete this asset category? Additional checks will be performed before actual deletion to ensure data integrity is not compromised.') . "');\">" . _('Delete') . "</td> + </tr>", + $myrow[0], + $myrow[1], + $myrow[2], + $myrow[3], + $myrow[4], +// $myrow[5], + $myrow[6], + $myrow[7], + $_SERVER['PHP_SELF'] . '?' . SID, + $myrow[0], + $_SERVER['PHP_SELF'] . '?' . SID, + $myrow[0]); + } + //END WHILE LIST LOOP + echo '</table>'; +} + +//end of ifs and buts! + +?> + +<p> +<?php +if (isset($SelectedCategory)) { ?> + <div class='centre'><a href="<?php echo $_SERVER['PHP_SELF'] . '?' . SID;?>"><?php echo _('Show All Stock Categories'); ?></a></div> +<?php } ?> + +<p> + +<?php + +if (! isset($_GET['delete'])) { + + echo '<form name="CategoryForm" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; + + if (isset($SelectedCategory)) { + //editing an existing asset category + if (!isset($_POST['UpdateTypes'])) { + $sql = "SELECT categoryid, + stocktype, + categorydescription, + stockact, + adjglact, + purchpricevaract, + materialuseagevarac, + wipact + FROM stockcategory + WHERE categoryid='" . $SelectedCategory . "'"; + + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + + $_POST['CategoryID'] = $myrow['categoryid']; + $_POST['StockType'] = $myrow['stocktype']; + $_POST['CategoryDescription'] = $myrow['categorydescription']; + $_POST['StockAct'] = $myrow['stockact']; + $_POST['AdjGLAct'] = $myrow['adjglact']; + $_POST['PurchPriceVarAct'] = $myrow['purchpricevaract']; + $_POST['MaterialUseageVarAc'] = $myrow['materialuseagevarac']; + $_POST['WIPAct'] = $myrow['wipact']; + } + echo '<input type=hidden name="SelectedCategory" value="' . $SelectedCategory . '">'; + echo '<input type=hidden name="CategoryID" value="' . $_POST['CategoryID'] . '">'; + echo '<table><tr><td>' . _('Asset Category Code') . ':</td><td>' . $_POST['CategoryID'] . '</td></tr>'; + + } else { //end of if $SelectedCategory only do the else when a new record is being entered + if (!isset($_POST['CategoryID'])) { + $_POST['CategoryID'] = ''; + } + echo '<table><tr><td>' . _('Asset Category Code') . ':</td> + <td><input type="Text" name="CategoryID" size=7 maxlength=6 value="' . $_POST['CategoryID'] . '"></td></tr>'; + } + + //SQL to poulate account selection boxes + $sql = "SELECT accountcode, + accountname + FROM chartmaster, + accountgroups + WHERE chartmaster.group_=accountgroups.groupname and + accountgroups.pandl=0 + ORDER BY accountcode"; + + $BSAccountsResult = DB_query($sql,$db); + + $sql = "SELECT accountcode, + accountname + FROM chartmaster, + accountgroups + WHERE chartmaster.group_=accountgroups.groupname and + accountgroups.pandl!=0 + ORDER BY accountcode"; + + $PnLAccountsResult = DB_query($sql,$db); + + if (!isset($_POST['CategoryDescription'])) { + $_POST['CategoryDescription'] = ''; + } + + echo '<tr><td>' . _('Category Description') . ':</td> + <td><input type="Text" name="CategoryDescription" size=22 maxlength=20 value="' . $_POST['CategoryDescription'] . '"></td></tr>'; + + +/* echo '<tr><td>' . _('Stock Type') . ':</td> + <td><select name="StockType" onChange="ReloadForm(CategoryForm.UpdateTypes)" >'; + if (isset($_POST['StockType']) and $_POST['StockType']=='F') { + echo '<option selected value="F">' . _('Finished Goods'); + } else { + echo '<option value="F">' . _('Finished Goods'); + } + if (isset($_POST['StockType']) and $_POST['StockType']=='M') { + echo '<option selected value="M">' . _('Raw Materials'); + } else { + echo '<option value="M">' . _('Raw Materials'); + } + if (isset($_POST['StockType']) and $_POST['StockType']=='D') { + echo '<option selected value="D">' . _('Dummy Item - (No Movements)'); + } else { + echo '<option value="D">' . _('Dummy Item - (No Movements)'); + } + if (isset($_POST['StockType']) and $_POST['StockType']=='L') { + echo '<option selected value="L">' . _('Labour'); + } else { + echo '<option value="L">' . _('Labour'); + } + + echo '</select></td></tr>'; +*/ + echo '<input type=hidden name="StockType" value="A">'; + echo '<input type="submit" name="UpdateTypes" style="visibility:hidden;width:1px" value="Not Seen">'; + echo '<tr><td>' . _('Fixed Asset GL Code'); + + echo ':</td><td><select name="StockAct">'; + + while ($myrow = DB_fetch_array($BSAccountsResult)){ + + if (isset($_POST['StockAct']) and $myrow['accountcode']==$_POST['StockAct']) { + echo '<option selected value='; + } else { + echo '<option value='; + } + echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')'; + } //end while loop + DB_data_seek($PnLAccountsResult,0); + DB_data_seek($BSAccountsResult,0); + echo '</select></td></tr>'; + + echo '<tr><td>' . _('Balance Sheet Depreciation GL Code') . ':</td><td><select name="WIPAct">'; + + while ($myrow = DB_fetch_array($BSAccountsResult)) { + + if (isset($_POST['WIPAct']) and $myrow['accountcode']==$_POST['WIPAct']) { + echo '<option selected value='; + } else { + echo '<option value='; + } + echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')'; + + } //end while loop + echo '</select></td></tr>'; + DB_data_seek($BSAccountsResult,0); + + echo '<tr><td>' . _('Profit and Loss Depreciation GL Code') . ':</td> + <td><select name="AdjGLAct">'; + + while ($myrow = DB_fetch_array($PnLAccountsResult)) { + if (isset($_POST['AdjGLAct']) and $myrow['accountcode']==$_POST['AdjGLAct']) { + echo '<option selected value='; + } else { + echo '<option value='; + } + echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')'; + + } //end while loop + DB_data_seek($PnLAccountsResult,0); + echo '</select></td></tr>'; + +/* echo '<tr><td>' . _('Price Variance GL Code') . ':</td> + <td><select name="PurchPriceVarAct">'; + + while ($myrow = DB_fetch_array($PnLAccountsResult)) { + if (isset($_POST['PurchPriceVarAct']) and $myrow['accountcode']==$_POST['PurchPriceVarAct']) { + echo '<option selected value='; + } else { + echo '<option value='; + } + echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')'; + + } //end while loop + DB_data_seek($PnLAccountsResult,0); + + echo '</select></td></tr><tr><td>'; */ + echo '<tr><td>'; + if (isset($_POST['StockType']) and $_POST['StockType']=='L') { + echo _('Other Capitalized Goods P/L Code'); + } else { + echo _('Sale of Asset account'); + } + echo ':</td><td><select name="MaterialUseageVarAc">'; + + while ($myrow = DB_fetch_array($PnLAccountsResult)) { + if (isset($_POST['MaterialUseageVarAc']) and $myrow['accountcode']==$_POST['MaterialUseageVarAc']) { + echo '<option selected value='; + } else { + echo '<option value='; + } + echo $myrow['accountcode'] . '>' . $myrow['accountname'] . ' ('.$myrow['accountcode'].')'; + + } //end while loop + DB_free_result($PnLAccountsResult); + echo '</select></td></tr></table><br>'; + + $sql='SELECT COUNT(categoryid) + FROM stockcatproperties + WHERE categoryid="dpntyp"'; + $result=DB_query($sql,$db); + $row=DB_fetch_array($result); + if ($row['categoryid']==0) { + } + echo '<table>'; + + + echo '<div class="centre"><input type="Submit" name="submit" value="' . _('Enter Information') . '"></div>'; + + echo '</form>'; + +} //end if record deleted no point displaying form to add record + + +include('includes/footer.inc'); +?> Added: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php (rev 0) +++ trunk/FixedAssetItems.php 2009-11-03 15:47:26 UTC (rev 2684) @@ -0,0 +1,926 @@ +<?php + +/* $Revision: 1.2 $ */ + +$PageSecurity = 11; + +include('includes/session.inc'); +$title = _('Fixed Asset Maintenance'); +include('includes/header.inc'); + +/*If this form is called with the StockID then it is assumed that the stock item is to be modified */ + +if (isset($_GET['StockID'])){ + $StockID =trim(strtoupper($_GET['StockID'])); +} elseif (isset($_POST['StockID'])){ + $StockID =trim(strtoupper($_POST['StockID'])); +} else { + $StockID = ''; +} + +if (isset($StockID)) { + $sql = "SELECT COUNT(stockid) FROM assetmanager WHERE stockid='".$StockID."'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]==0) { + $New=1; + } +} + +echo '<a href="' . $rootpath . '/SelectProduct.php?' . SID . '">' . _('Back to Items') . '</a><br>' . "\n"; + + +if (isset($_FILES['ItemPicture']) AND $_FILES['ItemPicture']['name'] !='') { + + $result = $_FILES['ItemPicture']['error']; + $UploadTheFile = 'Yes'; //Assume all is well to start off with + $filename = $_SESSION['part_pics_dir'] . '/' . $StockID . '.jpg'; + + //But check for the worst + if (strtoupper(substr(trim($_FILES['ItemPicture']['name']),strlen($_FILES['ItemPicture']['name'])-3))!='JPG'){ + prnMsg(_('Only jpg files are supported - a file extension of .jpg is expected'),'warn'); + $UploadTheFile ='No'; + } elseif ( $_FILES['ItemPicture']['size'] > ($_SESSION['MaxImageSize']*1024)) { //File Size Check + prnMsg(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $_SESSION['MaxImageSize'],'warn'); + $UploadTheFile ='No'; + } elseif ( $_FILES['ItemPicture']['type'] == "text/plain" ) { //File Type Check + prnMsg( _('Only graphics files can be uploaded'),'warn'); + $UploadTheFile ='No'; + } elseif (file_exists($filename)){ + prnMsg(_('Attempting to overwrite an existing item image'),'warn'); + $result = unlink($filename); + if (!$result){ + prnMsg(_('The existing image could not be removed'),'error'); + $UploadTheFile ='No'; + } + } + + if ($UploadTheFile=='Yes'){ + $result = move_uploaded_file($_FILES['ItemPicture']['tmp_name'], $filename); + $message = ($result)?_('File url') ."<a href='". $filename ."'>" . $filename . '</a>' : _('Something is wrong with uploading a file'); + } + /* EOR Add Image upload for New Item - by Ori */ +} + +if (isset($Errors)) { + unset($Errors); +} +$Errors = array(); +$InputError = 0; + +if (isset($_POST['submit'])) { + + //initialise no input errors assumed initially before we test + + /* actions to take once the user has clicked the submit button + ie the page has called itself with some user input */ + + //first off validate inputs sensible + $i=1; + + + if (!isset($_POST['Description']) or strlen($_POST['Description']) > 50 OR strlen($_POST['Description'])==0) { + $InputError = 1; + prnMsg (_('The stock item description must be entered and be fifty characters or less long') . '. ' . _('It cannot be a zero length string either') . ' - ' . _('a description is required'),'error'); + $Errors[$i] = 'Description'; + $i++; + } + if (strlen($_POST['LongDescription'])==0) { + $InputError = 1; + prnMsg (_('The stock item description cannot be a zero length string') . ' - ' . _('a long description is required'),'error'); + $Errors[$i] = 'LongDescription'; + $i++; + } + if (strlen($StockID) ==0) { + $InputError = 1; + prnMsg (_('The Stock Item code cannot be empty'),'error'); + $Errors[$i] = 'StockID'; + $i++; + } + if (strstr($StockID,' ') OR strstr($StockID,"'") OR strstr($StockID,'+') OR strstr($StockID,"\\") OR strstr($StockID,"\"") OR strstr($StockID,'&') OR strstr($StockID,'.') OR strstr($StockID,'"')) { + $InputError = 1; + prnMsg(_('The stock item code cannot contain any of the following characters') . " - ' & + \" \\ " . _('or a space'),'error'); + $Errors[$i] = 'StockID'; + $i++; + $StockID=''; + } + if (strlen($_POST['Units']) >20) { + $InputError = 1; + prnMsg(_('The unit of measure must be 20 characters or less long'),'error'); + $Errors[$i] = 'Units'; + $i++; + } + if (strlen($_POST['BarCode']) >20) { + $InputError = 1; + prnMsg(_('The barcode must be 20 characters or less long'),'error'); + $Errors[$i] = 'BarCode'; + $i++; + } + if (!is_numeric($_POST['Volume'])) { + $InputError = 1; + prnMsg (_('The volume of the packaged item in cubic metres must be numeric') ,'error'); + $Errors[$i] = 'Volume'; + $i++; + } + if ($_POST['Volume'] <0) { + $InputError = 1; + prnMsg(_('The volume of the packaged item must be a positive number'),'error'); + $Errors[$i] = 'Volume'; + $i++; + } + if (!is_numeric($_POST['KGS'])) { + $InputError = 1; + prnMsg(_('The weight of the packaged item in KGs must be numeric'),'error'); + $Errors[$i] = 'KGS'; + $i++; + } + if ($_POST['KGS']<0) { + $InputError = 1; + prnMsg(_('The weight of the packaged item must be a positive number'),'error'); + $Errors[$i] = 'KGS'; + $i++; + } + if (!is_numeric($_POST['EOQ'])) { + $InputError = 1; + prnMsg(_('The economic order quantity must be numeric'),'error'); + $Errors[$i] = 'EOQ'; + $i++; + } + if ($_POST['EOQ'] <0) { + $InputError = 1; + prnMsg (_('The economic order quantity must be a positive number'),'error'); + $Errors[$i] = 'EOQ'; + $i++; + } + if ($_POST['Controlled']==0 AND $_POST['Serialised']==1){ + $InputError = 1; + prnMsg(_('The item can only be serialised if there is lot control enabled already') . '. ' . _('Batch control') . ' - ' . _('with any number of items in a lot/bundle/roll is enabled when controlled is enabled') . '. ' . _('Serialised control requires that only one item is in the batch') . '. ' . _('For serialised control') . ', ' . _('both controlled and serialised must be enabled'),'error'); + $Errors[$i] = 'Serialised'; + $i++; + } + if ($_POST['NextSerialNo']!=0 AND $_POST['Serialised']==0){ + $InputError = 1; + prnMsg(_('The item can only have automatically generated serial numbers if it is a serialised item'),'error'); + $Errors[$i] = 'NextSerialNo'; + $i++; + } + if ($_POST['NextSerialNo']!=0 AND $_POST['MBFlag']!='M'){ + $InputError = 1; + prnMsg(_('The item can only have automatically generated serial numbers if it is a manufactured item'),'error'); + $Errors[$i] = 'NextSerialNo'; + $i++; + } + if (($_POST['MBFlag']=='A' OR $_POST['MBFlag']=='K' OR $_POST['MBFlag']=='D' OR $_POST['MBFlag']=='G') AND $_POST['Controlled']==1){ + $InputError = 1; + prnMsg(_('Assembly/Kitset/Phantom/Service/Labour items cannot also be controlled items') . '. ' . _('Assemblies/Dummies/Phantom and Kitsets are not physical items and batch/serial control is therefore not appropriate'),'error'); + $Errors[$i] = 'Controlled'; + $i++; + } + if (trim($_POST['CategoryID'])==''){ + $InputError = 1; + prnMsg(_('There are no inventory categories defined. All inventory items must belong to a valid inventory category,'),'error'); + $Errors[$i] = 'CategoryID'; + $i++; + } + if (!is_numeric($_POST['Pansize'])) { + $InputError = 1; + prnMsg(_('Pansize quantity must be numeric'),'error'); + $Errors[$i] = 'Pansize'; + $i++; + } + if (!is_numeric($_POST['ShrinkFactor'])) { + $InputError = 1; + prnMsg(_('Shrinkage factor quantity must be numeric'),'error'); + $Errors[$i] = 'ShrinkFactor'; + $i++; + } + + if ($InputError !=1){ + if ($_POST['Serialised']==1){ /*Not appropriate to have several dp on serial items */ + $_POST['DecimalPlaces']=0; + } + if (!isset($_POST['New']) and !isset($New)) { /*so its an existing one */ + + /*first check on the changes being made we must disallow: + - changes from manufactured or purchased to Service, Assembly or Kitset if there is stock - changes from manufactured, kitset or assembly where a BOM exists + */ + $sql = "SELECT mbflag, + controlled, + serialised + FROM stockmaster WHERE stockid = '$StockID'"; + $MBFlagResult = DB_query($sql,$db); + $myrow = DB_fetch_row($MBFlagResult); + $OldMBFlag = $myrow[0]; + $OldControlled = $myrow[1]; + $OldSerialised = $myrow[2]; + + $sql = "SELECT SUM(locstock.quantity) FROM locstock WHERE stockid='$StockID'"; + $result = DB_query($sql,$db); + $stkqtychk = DB_fetch_row($result); + + if ($OldMBFlag != $_POST['MBFlag']){ + if (($OldMBFlag == 'M' OR $OldMBFlag=='B') AND ($_POST['MBFlag']=='A' OR $_POST['MBFlag']=='K' OR $_POST['MBFlag']=='D' OR $_POST['MBFlag']=='G')){ /*then need to check that there is no stock holding first */ + /* stock holding OK for phantom (ghost) items */ + if ($stkqtychk[0]!=0 AND $OldMBFlag!='G'){ + $InputError=1; + prnMsg( _('The make or buy flag cannot be changed from') . ' ' . $OldMBFlag . ' ' . _('to') . ' ' . $_POST['MBFlag'] . ' ' . _('where there is a quantity of stock on hand at any location') . '. ' . _('Currently there are') . ' ' . $stkqtychk[0] . ' ' . _('on hand') , 'errror'); + } + /* don't allow controlled/serialized */ + if ($_POST['Controlled']==1){ + $InputError=1; + prnMsg( _('The make or buy flag cannot be changed from') . ' ' . $OldMBFlag . ' ' . _('to') . ' ' . $_POST['MBFlag'] . ' ' . _('where the item is to be lot controlled') . '. ' . _('Kitset, phantom, dummy and assembly items cannot be lot controlled'), 'error'); + } + } + /*now check that if the item is being changed to a kitset, there are no items on sales orders or purchase orders*/ + if ($_POST['MBFlag']=='K') { + $sql = "SELECT quantity-qtyinvoiced + FROM salesorderdetails + WHERE stkcode = '$StockID' + AND completed=0"; + + $result = DB_query($sql,$db); + $ChkSalesOrds = DB_fetch_row($result); + if ($ChkSalesOrds[0]!=0){ + $InputError = 1; + prnMsg( _('The make or buy flag cannot be changed to a kitset where there is a quantity outstanding to be delivered on sales orders') . '. ' . _('Currently there are') .' ' . $ChkSalesOrds[0] . ' '. _('outstanding'), 'error'); + } + } + /*now check that if it is to be a kitset or assembly or dummy there is no quantity on purchase orders outstanding*/ + if ($_POST['MBFlag']=='K' OR $_POST['MBFlag']=='A' OR $_POST['MBFlag']=='D') { + + $sql = "SELECT quantityord-quantityrecd + FROM purchorderdetails + WHERE itemcode = '$StockID' + AND completed=0"; + + $result = DB_query($sql,$db); + $ChkPurchOrds = DB_fetch_row($result); + if ($ChkPurchOrds[0]!=0){ + $InputError = 1; + prnMsg( _('The make or buy flag cannot be changed to'). ' ' . $_POST['MBFlag'] . ' '. _('where there is a quantity outstanding to be received on purchase orders') . '. ' . _('Currently there are'). ' ' . $ChkPurchOrds[0] . ' '. _('yet to be received'). 'error'); + } + } + + /*now check that if it was a Manufactured, Kitset, Phantom or Assembly and is being changed to a purchased or dummy - that no BOM exists */ + if (($OldMBFlag=='M' OR $OldMBFlag =='K' OR $OldMBFlag=='A' OR $OldMBFlag=='G') AND ($_POST['MBFlag']=='B' OR $_POST['MBFlag']=='D')) { + $sql = "SELECT COUNT(*) FROM bom WHERE parent = '$StockID'"; + $result = DB_query($sql,$db); + $ChkBOM = DB_fetch_row($result); + if ($ChkBOM[0]!=0){ + $InputError = 1; + prnMsg( _('The make or buy flag cannot be changed from manufactured, kitset or assembly to'). ' ' . $_POST['MBFlag'] . ' '. _('where there is a bill of material set up for the item') . '. ' . _('Bills of material are not appropriate for purchased or dummy items'), 'error'); + } + } + + /*now check that if it was Manufac, Phantom or Purchased and is being changed to assembly or kitset, it is not a component on an existing BOM */ + if (($OldMBFlag=='M' OR $OldMBFlag =='B' OR $OldMBFlag=='D' OR $OldMBFlag=='G') AND ($_POST['MBFlag']=='A' OR $_POST['MBFlag']=='K')) { + $sql = "SELECT COUNT(*) FROM bom WHERE component = '$StockID'"; + $result = DB_query($sql,$db); + $ChkBOM = DB_fetch_row($result); + if ($ChkBOM[0]!=0){ + $InputError = 1; + prnMsg( _('The make or buy flag cannot be changed from manufactured, purchased or dummy to a kitset or assembly where the item is a component in a bill of material') . '. ' . _('Assembly and kitset items are not appropriate as components in a bill of materials'), 'error'); + } + } + } + + /* Do some checks for changes in the Serial & Controlled setups */ + if ($OldControlled != $_POST['Controlled'] AND $stkqtychk[0]!=0){ + $InputError=1; + prnMsg( _('You can not change a Non-Controlled Item to Controlled (or back from Controlled to non-controlled when there is currently stock on hand for the item') , 'error'); + + } + if ($OldSerialised != $_POST['Serialised'] AND $stkqtychk[0]!=0){ + $InputError=1; + prnMsg( _('You can not change a Serialised Item to Non-Serialised (or vice-versa) when there is a quantity on hand for the item') , 'error'); + } + + + if ($InputError == 0){ + $sql = "UPDATE stockmaster + SET longdescription='" . $_POST['LongDescription'] . "', + description='" . $_POST['Description'] . "', + discontinued=" . $_POST['Discontinued'] . ", + controlled=" . $_POST['Controlled'] . ", + serialised=" . $_POST['Serialised'].", + perishable=" . $_POST['Perishable'].", + categoryid='" . $_POST['CategoryID'] . "', + units='" . $_POST['Units'] . "', + mbflag='" . $_POST['MBFlag'] . "', + eoq=" . $_POST['EOQ'] . ", + volume=" . $_POST['Volume'] . ", + kgs=" . $_POST['KGS'] . ", + barcode='" . $_POST['BarCode'] . "', + discountcategory='" . $_POST['DiscountCategory'] . "', + taxcatid=" . $_POST['TaxCat'] . ", + decimalplaces=" . $_POST['DecimalPlaces'] . ", + appendfile='" . $_POST['ItemPDF'] . "', + shrinkfactor=" . $_POST['ShrinkFactor'] . ", + pansize=" . $_POST['Pansize'] . ", + nextserialno=" . $_POST['NextSerialNo'] . " + WHERE stockid='$StockID'"; + + $ErrMsg = _('The stock item could not be updated because'); + $DbgMsg = _('The SQL that was used to update the stock item and failed was'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg); + + //delete any properties for the item no longer relevant with the change of category + $result = DB_query("DELETE FROM stockitemproperties + WHERE stockid ='" . $StockID . "'", + $db); + + //now insert any item properties + for ($i=0;$i<=$_POST['PropertyCounter'];$i++){ + + if ($_POST['PropType' . $i] ==2){ + if ($_POST['PropValue' . $i]=='on'){ + $_POST['PropValue' . $i]=1; + } else { + $_POST['PropValue' . $i]=0; + } + } + $result = DB_query("INSERT INTO stockitemproperties (stockid, + stkcatpropid, + value) + VALUES ('" . $StockID . "', + " . $_POST['PropID' . $i] . ", + '" . $_POST['PropValue' . $i] . "')", + $db); + } //end of loop around properties defined for the category + prnMsg( _('Stock Item') . ' ' . $StockID . ' ' . _('has been updated'), 'success'); + } + + } else { //it is a NEW part + //but lets be really sure here + $result = DB_query("SELECT stockid FROM stockmaster WHERE stockid='" . $StockID ."'",$db); + if (DB_num_rows($result)==1){ + prnMsg(_('The stock code entered is actually already in the database - duplicate stock codes are prohibited by the system. Try choosing an alternative stock code'),'error'); + exit; + } else { + $sql = "INSERT INTO stockmaster ( + stockid, + description, + longdescription, + categoryid, + units, + mbflag, + eoq, + discontinued, + controlled, + serialised, + perishable, + volume, + kgs, + barcode, + discountcategory, + taxcatid, + decimalplaces, + appendfile, + shrinkfactor, + pansize) + VALUES ('$StockID', + '" . $_POST['Description'] . "', + '" . $_POST['LongDescription'] . "', + '" . $_POST['CategoryID'] . "', + '" . $_POST['Units'] . "', + '" . $_POST['MBFlag'] . "', + " . $_POST['EOQ'] . ", + " . $_POST['Discontinued'] . ", + " . $_POST['Controlled'] . ", + " . $_POST['Serialised']. ", + " . $_POST['Perishable']. ", + " . $_POST['Volume'] . ", + " . $_POST['KGS'] . ", + '" . $_POST['BarCode'] . "', + '" . $_POST['DiscountCategory'] . "', + " . $_POST['TaxCat'] . ", + " . $_POST['DecimalPlaces']. ", + '" . $_POST['ItemPDF']. "', + " . $_POST['ShrinkFactor'] . ", + " . $_POST['Pansize'] . " + )"; + + $ErrMsg = _('The item could not be added because'); + $DbgMsg = _('The SQL that was used to add the item failed was'); + $result = DB_query($sql,$db, $ErrMsg, $DbgMsg); + //now insert any item properties + for ($i=0;$i<=$_POST['PropertyCounter'];$i++){ + + if ($_POST['PropType' . $i] ==2){ + if ($_POST['PropValue' . $i]=='on'){ + $_POST['PropValue' . $i]=1; + } else { + $_POST['PropValue' . $i]=0; + } + } + $sql="INSERT INTO stockitemproperties (stockid, + stkcatpropid, + value) + VALUES ('" . $StockID . "', + " . $_POST['PropID' . $i] . ", + '" . $_POST['PropValue' . $i] . "')"; + $result = DB_query($sql,$db); + } //end of loop around properties defined for the category + if (DB_error_no($db) ==0) { + + $sql = "INSERT INTO locstock (loccode, + stockid) + SELECT locations.loccode, + '" . $StockID . "' + FROM locations"; + + $ErrMsg = _('The locations for the item') . ' ' . $StockID . ' ' . _('could not be added because'); + $DbgMsg = _('NB Locations records can be added by opening the utility page') . ' <i>Z_MakeStockLocns.php</i> ' . _('The SQL that was used to add the location records that failed was'); + $InsResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); + + if (DB_error_no($db) ==0) { + prnMsg( _('New Item') .' ' . "<a + href='SelectProduct.php?StockID=$StockID'>$StockID</a>" . ' '. _('has been added to the database'),'success'); unset($_POST['LongDescription']); + unset($_POST['Description']); + unset($_POST['EOQ']); +// Leave Category ID set for ease of batch entry +// unset($_POST['CategoryID']); + unset($_POST['Units']); + unset($_POST['MBFlag']); + unset($_POST['Discontinued']); + unset($_POST['Controlled']); + unset($_POST['Serialised']); + unset($_POST['Perishable']); + unset($_POST['Volume']); + unset($_POST['KGS']); + unset($_POST['BarCode']); + unset($_POST['ReorderLevel']); + unset($_POST['DiscountCategory']); + unset($_POST['DecimalPlaces']); + unset($_POST['ItemPDF']); + unset($_POST['ShrinkFactor']); + unset($_POST['Pansize']); + unset($StockID); + }//ALL WORKED SO RESET THE FORM VARIABLES + }//THE INSERT OF THE NEW CODE WORKED SO BANG IN THE STOCK LOCATION RECORDS TOO + }//END CHECK FOR ALREADY EXISTING ITEM OF THE SAME CODE + } + + } else { + echo '<br>'. "\n"; + prnMsg( _('Validation failed, no updates or deletes took place'), 'error'); + } + +} elseif (isset($_POST['delete']) AND strlen($_POST['delete']) >1 ) { +//the button to delete a selected record was clicked instead of the submit button + + $CancelDelete = 0; + +// PREVENT DELETES IF DEPENDENT RECORDS IN 'StockMoves' + + $sql= "SELECT COUNT(*) FROM stockmoves WHERE stockid='$StockID'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]>0) { + $CancelDelete = 1; + prnMsg( _('Cannot delete this stock item because there are stock movements that refer to this item'),'warn'); + echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('stock movements that refer to this item'); + + } else { + $sql= "SELECT COUNT(*) FROM bom WHERE component='$StockID'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]>0) { + $CancelDelete = 1; + prnMsg( _('Cannot delete this item record because there are bills of material that require this part as a component'),'warn'); + echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('bills of material that require this part as a component'); + } else { + $sql= "SELECT COUNT(*) FROM salesorderdetails WHERE stkcode='$StockID'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]>0) { + $CancelDelete = 1; + prnMsg( _('Cannot delete this item record because there are existing sales orders for this part'),'warn'); + echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales order items against this part'); + } else { + $sql= "SELECT COUNT(*) FROM salesanalysis WHERE stockid='$StockID'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]>0) { + $CancelDelete = 1; + prnMsg(_('Cannot delete this item because sales analysis records exist for it'),'warn'); + echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('sales analysis records against this part'); + } else { + $sql= "SELECT COUNT(*) FROM purchorderdetails WHERE itemcode='$StockID'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]>0) { + $CancelDelete = 1; + prnMsg(_('Cannot delete this item because there are existing purchase order items for it'),'warn'); + echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('purchase order item record relating to this part'); + } else { + $sql = "SELECT SUM(quantity) AS qoh FROM locstock WHERE stockid='$StockID'"; + $result = DB_query($sql,$db); + $myrow = DB_fetch_row($result); + if ($myrow[0]!=0) { + $CancelDelete = 1; + prnMsg( _('Cannot delete this item because there is currently some stock on hand'),'warn'); + echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('on hand for this part'); + } + } + } + } + } + + } + if ($CancelDelete==0) { + $result = DB_Txn_Begin($db); + + /*Deletes LocStock records*/ + $sql ="DELETE FROM locstock WHERE stockid='$StockID'"; + $result=DB_query($sql,$db,_('Could not delete the location stock records because'),'',true); + /*Deletes Price records*/ + $sql ="DELETE FROM prices WHERE stockid='$StockID'"; + $result=DB_query($sql,$db,_('Could not delete the prices for this stock record because'),'',true); + /*and cascade deletes in PurchData */ + $sql ="DELETE FROM purchdata WHERE stockid='$StockID'"; + $result=DB_query($sql,$db,_('Could not delete the purchasing data because'),'',true); + /*and cascade delete the bill of material if any */ + $sql = "DELETE FROM bom WHERE parent='$StockID'"; + $result=DB_query($sql,$db,_('Could not delete the bill of material because'),'',true); + $sql="DELETE FROM stockmaster WHERE stockid='$StockID'"; + $result=DB_query($sql,$db, _('Could not delete the item record'),'',true); + + $result = DB_Txn_Commit($db); + + prnMsg(_('Deleted the stock master record for') . ' ' . $StockID . '....' . + '<br>. . ' . _('and all the location stock records set up for the part') . + '<br>. . .' . _('and any bill of material that may have been set up for the part') . + '<br> . . . .' . _('and any purchasing data that may have been set up for the part') . + '<br> . . . . .' . _('and any prices that may have been set up for the part'),'success'); + unset($_POST['LongDescription']); + unset($_POST['Description']); + unset($_POST['EOQ']); + unset($_POST['CategoryID']); + unset($_POST['Units']); + unset($_POST['MBFlag']); + unset($_POST['Discontinued']); + unset($_POST['Controlled']); + unset($_POST['Serialised']); + unset($_POST['Perishable']); + unset($_POST['Volume']); + unset($_POST['KGS']); + unset($_POST['BarCode']); + unset($_POST['ReorderLevel']); + unset($_POST['DiscountCategory']); + unset($_POST['TaxCat']); + unset($_POST['DecimalPlaces']); + unset($_POST['ItemPDF']); + unset($StockID); + unset($_SESSION['SelectedStockItem']); + //echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/SelectProduct.php?' . SID ."'>"; + + + } //end if Delete Part +} + + +echo '<form name="ItemForm" enctype="multipart/form-data" method="post" action="' . $_SERVER['PHP_SELF'] . '?' .SID .'"><table> + <tr><td><table>'. "\n"; // Nested table + +if (!isset($StockID) or $StockID=='') { + +/*If the page was called without $StockID passed to page then assume a new stock item is to be entered show a form with a part Code field other wise the form showing the fields with the existing entries against the part will show for editing with only a hidden StockID field. New is set to flag that the page may have called itself and still be entering a new part, in which case the page needs to know not to go looking up details for an existing part*/ + + $New = true; + echo '<input type="hidden" name="New" value="1">'. "\n"; + + echo '<tr><td>'. _('Asset Code'). ':</td><td><input ' . (in_array('StockID',$Errors) ? 'class="inputerror"' : '' ) .' type="text" name="StockID" size=21 maxlength=20></td></tr>'. "\n"; + +} elseif (!isset($_POST['UpdateCategories']) and $InputError!=1) { // Must be modifying an existing item and no changes made yet + + $sql = "SELECT stockid, + description, + longdescription, + categoryid, + units, + mbflag, + discontinued, + controlled, + serialised, + perishable, + eoq, + volume, + kgs, + barcode, + discountcategory, + taxcatid, + decimalplaces, + appendfile, + nextserialno + FROM stockmaster + WHERE stockid = '$StockID'"; + + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + + $_POST['LongDescription'] = $myrow['longdescription']; + $_POST['Description'] = $myrow['description']; + $_POST['EOQ'] = $myrow['eoq']; + $_POST['CategoryID'] = $myrow['categoryid']; + $_POST['Units'] = $myrow['units']; + $_POST['MBFlag'] = $myrow['mbflag']; + $_POST['Discontinued'] = $myrow['discontinued']; + $_POST['Controlled'] = $myrow['controlled']; + $_POST['Serialised'] = $myrow['serialised']; + $_POST['Perishable'] = $myrow['perishable']; + $_POST['Volume'] = $myrow['volume']; + $_POST['KGS'] = $myrow['kgs']; + $_POST['BarCode'] = $myrow['barcode']; + $_POST['DiscountCategory'] = $myrow['discountcategory']; + $_POST['TaxCat'] = $myrow['taxcatid']; + $_POST['DecimalPlaces'] = $myrow['decimalplaces']; + $_POST['ItemPDF'] = $myrow['appendfile']; + $_POST['NextSerialNo'] = $myrow['nextserialno']; + + echo '<tr><td>' . _('Asset Code') . ':</td><td>'.$StockID.'</td></tr>'. "\n"; + echo '<input type="Hidden" name="StockID" value='.$StockID.'>'. "\n"; + +} else { // some changes were made to the data so don't re-set form variables to DB ie the code above + echo '<tr><td>' . _('Asset Code') . ':</td><td>'.$StockID.'</td></tr>'; + echo "<input type='Hidden' name='StockID' value='$StockID'>"; +} + +if (isset($_POST['Description'])) { + $Description = $_POST['Description']; +} else { + $Description =''; +} +echo '<tr><td>' . _('Asset Description') . ' (' . _('short') . '):</td><td><input ' . (in_array('Description',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Description" size=52 maxlength=50 value="' . htmlentities($Description,ENT_QUOTES,_('ISO-8859-1')) . '"></td></tr>'."\n"; + +if (isset($_POST['LongDescription'])) { + $LongDescription = AddCarriageReturns($_POST['LongDescription']); +} 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"; + +// Generate selection drop down from pdf_append directory - by emdx, +// developed with examples from http://au2.php.net/manual/en/function.opendir.php +function select_files($dir, $label = '', $select_name = 'ItemPDF', $curr_val = '', $char_length = 60) { + $teller = 0; + if (!file_exists($dir)) { + mkdir($dir); + chmod($dir, 0777); + } + if ($handle = opendir($dir)) { + $mydir = "<select name=".$select_name.">\n"; + $mydir .= '<option VALUE=0>none'; + if (isset($_POST['ItemPDF'])) { + $curr_val = $_POST['ItemPDF']; + } else { + $curr_val .= 'none'; + } + while (false !== ($file = readdir($handle))) + { + $files[] = $file; + } + closedir($handle); + sort($files); + foreach ($files as $val) { + if (is_file($dir.$val)) { + $mydir .= '<option VALUE='.$val; + $mydir .= ($val == $curr_val) ? ' selected>' : '>'; + $mydir .= $val."\n"; + $teller++; + } + } + $mydir .= ""; + } + return $mydir; +} +if (!isset($_POST['ItemPDF'])) { + $_POST['ItemPDF'] = ''; +} +echo '<tr><td>' . _('PDF attachment (.pdf)') . ':' . "\n</td><td>" . select_files('companies/' . $_SESSION['DatabaseName'] .'/pdf_append//','' , 'ItemPDF', $_POST['ItemPDF'], '60') . '</td></tr>'. "\n"; + +// Add image upload for New Item - by Ori +echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td></tr>'; +// EOR Add Image upload for New Item - by Ori + + echo '<tr><td>' . _('Category') . ':</td><td><select name="CategoryID" onChange="ReloadForm(ItemForm.UpdateCategories)">'; + +$sql = 'SELECT categoryid, categorydescription FROM stockcategory WHERE stocktype="A"'; +$ErrMsg = _('The stock 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['CategoryID']) or $myrow['categoryid']==$_POST['CategoryID']){ + echo '<option selected VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']; + } else { + echo '<option VALUE="'. $myrow['categoryid'] . '">' . $myrow['categorydescription']; + } + $category=$myrow['categoryid']; +} +echo '</select><a target="_blank" href="'. $rootpath . '/FixedAssetCategories.php?' . SID . '">'.' ' . _('Add or Modify Asset Categories') . '</a></td></tr>'; +if (!isset($_POST['CategoryID'])) { + $_POST['CategoryID']=$category; +} + +if (!isset($_POST['EOQ']) or $_POST['EOQ']==''){ + $_POST['EOQ']=0; +} + +if (!isset($_POST['Volume']) or $_POST['Volume']==''){ + $_POST['Volume']=0; +} +if (!isset($_POST['KGS']) or $_POST['KGS']==''){ + $_POST['KGS']=0; +} +if (!isset($_POST['Controlled']) or $_POST['Controlled']==''){ + $_POST['Controlled']=0; +} +if (!isset($_POST['Serialised']) or $_POST['Serialised']=='' || $_POST['Controlled']==0){ + $_POST['Serialised']=0; +} +if (!isset($_POST['DecimalPlaces']) or $_POST['DecimalPlaces']==''){ + $_POST['DecimalPlaces']=0; +} +if (!isset($_POST['Discontinued']) or $_POST['Discontinued']==''){ + $_POST['Discontinued']=0; +} +if (!isset($_POST['Pansize'])) { + $_POST['Pansize']=0; +} +if (!isset($_POST['ShrinkFactor'])) { + $_POST['ShrinkFactor']=0; +} +if (!isset($_POST['NextSerialNo'])) { + $_POST['NextSerialNo']=0; +} + + +echo '<input type="hidden" class="number" name="EOQ" size=12 maxlength=10 value="0">'; + +echo '<tr><td>' . _('Packaged Volume (metres cubed)') . ':</td><td><input ' . (in_array('Volume',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" class="number" name="Volume" size=12 maxlength=10 value="' . $_POST['Volume'] . '"></td></tr>'; + +echo '<tr><td>' . _('Packaged Weight (KGs)') . ':</td><td><input ' . (in_array('KGS',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" class="number" name="KGS" size=12 maxlength=10 value="' . $_POST['KGS'] . '"></td></tr>'; + +if (!isset($_POST['Units'])) { + $UOMrow['unitname']=_('each'); +} + +echo '<input type=hidden name=Units value="each">'; + +echo '<tr><td>' . _('Manufactured or Purchased') . ':</td><td><select name="MBFlag">'; +if (!isset($_POST['MBFlag']) or $_POST['MBFlag']=='M'){ + echo '<option selected value="M">' . _('Manufactured') . '</option>'; +} else { + echo '<option value="M">' . _('Manufactured') . '</option>'; +} +if (!isset($_POST['MBFlag']) or $_POST['MBFlag']=='B' OR !isset($_POST['MBFlag']) OR $_POST['MBFlag']==''){ + echo '<option selected value="B">' . _('Purchased') . '</option>'; +} else { + echo '<option value="B">' . _('Purchased') . '</option>'; +} + +echo '</select></td></tr>'; + +echo '<input type=hidden name=Discontinued value="0">'; +echo '<input type=hidden name=Controlled value="1">'; +echo '<input type=hidden name=Serialised value="1">'; + + +echo '<input type=hidden name=Perishable value="0">'; + +echo '<input type="hidden" class="number" name="DecimalPlaces" size=1 maxlength=1 value="0">'; + +if (isset($_POST['BarCode'])) { + $BarCode = $_POST['BarCode']; +} else { + $BarCode=''; +} +echo '<tr><td>' . _('Bar Code') . ':</td><td><input ' . (in_array('BarCode',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="BarCode" size=22 maxlength=20 value="' . $BarCode . '"></td></tr>'; + +if (isset($_POST['DiscountCategory'])) { + $DiscountCategory = $_POST['DiscountCategory']; +} else { + $DiscountCategory=''; +} +echo '<input type="hidden" name="DiscountCategory" size=2 maxlength=2 value="' . $DiscountCategory . '">'; + +echo '<tr><td>' . _('Tax Category') . ':</td><td><select name="TaxCat">'; +$sql = 'SELECT taxcatid, taxcatname FROM taxcategories ORDER BY taxcatname'; +$result = DB_query($sql, $db); + +if (!isset($_POST['TaxCat'])){ + $_POST['TaxCat'] = $_SESSION['DefaultTaxCategory']; +} + +while ($myrow = DB_fetch_array($result)) { + if ($_POST['TaxCat'] == $myrow['taxcatid']){ + echo '<option selected value=' . $myrow['taxcatid'] . '>' . $myrow['taxcatname'] . '</option>'; + } else { + echo '<option value=' . $myrow['taxcatid'] . '>' . $myrow['taxcatname'] . '</option>'; + } +} //end while loop + +echo '</select></td></tr>'; + +echo '<input type="hidden" class="number" name="Pansize" size="6" maxlength="6" value=' . $_POST['Pansize'] . '>'; +echo '<input type="hidden" class="number" name="ShrinkFactor" size="6" maxlength="6" value=' . $_POST['ShrinkFactor'] . '>'; + + + if (function_exists('imagecreatefrompng')){ + $StockImgLink = '<img src="GetStockImage.php?SID&automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. + '&StockID='.urlencode($StockID). + '&text='. + '&width=64'. + '&height=64'. + '" >'; +} else { + if( isset($StockID) and file_exists($_SESSION['part_pics_dir'] . '/' .$StockID.'.jpg') ) { + $StockImgLink = '<img src="' . $_SESSION['part_pics_dir'] . '/' .$StockID.'.jpg" >'; + } else { + $StockImgLink = _('No Image'); + } +} + +echo '</table></td><td>' . _('Image') . '<br>'.$StockImgLink . '</td></tr></table><div class="centre">'; + +if (!isset($_POST['CategoryID'])) { + $_POST['CategoryID'] = ''; +} +echo '<table><tr><th colspan="2">' . _('Asset Category Properties') . '</th></tr>'; +$sql = "SELECT stkcatpropid, + label, + controltype, + defaultvalue + FROM stockcatproperties + WHERE categoryid ='" . $_POST['CategoryID'] . "' + AND reqatsalesorder =0 + ORDER BY stkcatpropid"; + +$PropertiesResult = DB_query($sql,$db); +$PropertyCounter = 0; +$PropertyWidth = array(); + +while ($PropertyRow=DB_fetch_array($PropertiesResult)){ + + $PropValResult = DB_query("SELECT value FROM + stockitemproperties + WHERE stockid='" . $StockID . "' + AND stkcatpropid =" . $PropertyRow['stkcatpropid'], + $db); + $PropValRow = DB_fetch_row($PropValResult); + $PropertyValue = $PropValRow[0]; + + echo '<input type="hidden" name="PropID' . $PropertyCounter . '" value=' .$PropertyRow['stkcatpropid'] .'>'; + + echo '<tr><td>' . $PropertyRow['label'] . '</td> + <td>'; + switch ($PropertyRow['controltype']) { + case 0; //textbox + echo '<input type="textbox" name="PropValue' . $PropertyCounter . '" size="20" maxlength="100" value="' . $PropertyValue . '">'; + break; + case 1; //select box + $OptionValues = explode(',',$PropertyRow['defaultvalue']); + echo '<select name="PropValue' . $PropertyCounter . '">'; + foreach ($OptionValues as $PropertyOptionValue){ + if ($PropertyOptionValue == $PropertyValue){ + echo '<option selected value="' . $PropertyOptionValue . '">' . $PropertyOptionValue . '</option>'; + } else { + echo '<option value="' . $PropertyOptionValue . '">' . $PropertyOptionValue . '</option>'; + } + } + echo '</select>'; + break; + case 2; //checkbox + echo '<input type="checkbox" name="PropValue' . $PropertyCounter . '"'; + if ($PropertyValue==1){ + echo '"checked"'; + } + echo '>'; + break; + } //end switch + echo '<input type="hidden" name="PropType' . $PropertyCounter .'" value=' . $PropertyRow['controltype'] . '>'; + echo '</td></tr>'; + $PropertyCounter++; +} //end loop round properties for the item category +echo '</table>'; +echo '<input type="hidden" name="PropertyCounter" value=2>'; + +if (isset($New)) { + echo '<input type="Submit" name="submit" value="' . _('Insert New Item') . '">'; + echo '<input type="submit" name="UpdateCategories" style="visibility:hidden;width:1px" value="' . _('Categories') . '">'; + +} else { + + // Now the form to enter the item properties + + echo '<input type="submit" name="submit" value="' . _('Update') . '">'; + echo '<input type="submit" name="UpdateCategories" style="visibility:hidden;width:1px" value="' . _('Categories') . '">'; + echo '<p>'; + prnMsg( _('Only click the Delete button if you are sure you wish to delete the item!') . _('Checks will be made to ensure that there are no stock movements, sales analysis records, sales order items or purchase order items for the item') . '. ' . _('No deletions will be allowed if they exist'), 'warn', _('WARNING')); + echo '<p><input type="Submit" name="delete" value="' . _('Delete This Item') . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">'; +} + +echo '</form></div>'; +include('includes/footer.inc'); +?> Added: trunk/FixedAssetJournal.php =================================================================== --- trunk/FixedAssetJournal.php (rev 0) +++ trunk/FixedAssetJournal.php 2009-11-03 15:47:26 UTC (rev 2684) @@ -0,0 +1,426 @@ +<?php + +/* $Revision: 1.2 $ */ + +include('includes/DefineJournalClass.php'); + +$PageSecurity = 10; +include('includes/session.inc'); +$title = _('Depreciation Journal Entry'); + +include('includes/header.inc'); +include('includes/SQL_CommonFunctions.inc'); + +if (isset($_GET['NewJournal']) and $_GET['NewJournal'] == 'Yes' AND isset($_SESSION['JournalDetail'])){ + unset($_SESSION['JournalDetail']->GLEntries); + unset($_SESSION['JournalDetail']); +} + +if (!isset($_SESSION['JournalDetail']) or isset($_POST['update'])){ + $_SESSION['JournalDetail'] = new Journal; + + /* Make an array of the defined bank accounts - better to make it now than do it each time a line is added + Journals cannot be entered against bank accounts GL postings involving bank accounts must be done using + a receipt or a payment transaction to ensure a bank trans is available for matching off vs statements */ + + $SQL = 'SELECT accountcode FROM bankaccounts'; + $result = DB_query($SQL,$db); + $i=0; + while ($Act = DB_fetch_row($result)){ + $_SESSION['JournalDetail']->BankAccounts[$i]= $Act[0]; + $i++; + } + + /* Get list of assets for journal */ + $sql='SELECT assetmanager.*, + stockcategory.stockact as bsdepn, + stockcategory.adjglact as pldepn, + fixedassetlocations.locationdescription + FROM assetmanager + LEFT JOIN stockmaster + ON assetmanager.stockid=stockmaster.stockid + LEFT JOIN stockcategory + ON stockmaster.categoryid=stockcategory.categoryid + LEFT JOIN fixedassetlocations + ON fixedassetlocations.locationid=assetmanager.location'; + $result=DB_query($sql, $db); + $i=0; + while ($myrow=DB_fetch_array($result)) { + $assetarray[$i]=$myrow; + // Find depreciation type + $typesql='SELECT stockitemproperties.value + FROM stockitemproperties + LEFT JOIN stockcatproperties + ON stockcatproperties.stkcatpropid=stockitemproperties.stkcatpropid + WHERE stockitemproperties.stockid="'.$myrow['stockid'].'" + AND stockcatproperties.label="'._('Depreciation Type').'"'; + $typeresult=DB_query($typesql,$db); + $typerow=DB_fetch_array($typeresult); + $assetarray[$i]['DepreciationType']=$typerow['value']; + + // Find the depreciation rate + $ratesql='SELECT stockitemproperties.value + FROM stockitemproperties + LEFT JOIN stockcatproperties + ON stockcatproperties.stkcatpropid=stockitemproperties.stkcatpropid + WHERE stockitemproperties.stockid="'.$myrow['stockid'].'" + AND stockcatproperties.label="'._('Annual Depreciation Percentage').'"'; + $rateresult=DB_query($ratesql, $db); + $raterow=DB_fetch_array($rateresult); + $assetarray[$i]['DepreciationRate']=$raterow['value']; + + $bsnamesql='SELECT accountname FROM chartmaster WHERE accountcode='.$assetarray[$i]['bsdepn']; + $bsnameresult=DB_query($bsnamesql, $db); + $bsnamerow=DB_fetch_array($bsnameresult); + $assetarray[$i]['bsdepnaccount']=$bsnamerow['accountname']; + + $plnamesql='SELECT accountname FROM chartmaster WHERE accountcode='.$assetarray[$i]['pldepn']; + $plnameresult=DB_query($plnamesql, $db); + $plnamerow=DB_fetch_array($plnameresult); + $assetarray[$i]['pldepnaccount']=$plnamerow['accountname']; + + /* Need a method to correctly enter the journal date, + * and for it to be available to the depn calculation - Tim + */ + + if (isset($_POST['JournalProcessDate'])) { + $_SESSION['JournalDetail']->JnlDate=$_POST['JournalProcessDate']; + } + if (!Is_Date($_SESSION['JournalDetail']->JnlDate)){ + // Default the date to the last day of the previous month + $_SESSION['JournalDetail']->JnlDate = Date($_SESSION['DefaultDateFormat'],mktime(0,0,0,date('m'),0,date('Y'))); + } + + $NoOfMonths=DateDiff($_SESSION['JournalDetail']->JnlDate,FormatDateForSQL($assetarray[$i]['datepurchased']), 'm'); + if ($assetarray[$i]['DepreciationType']==_('Straight Line')) { + ... [truncated message content] |
From: <tim...@us...> - 2009-11-04 11:10:34
|
Revision: 2789 http://web-erp.svn.sourceforge.net/web-erp/?rev=2789&view=rev Author: tim_schofield Date: 2009-11-04 11:10:28 +0000 (Wed, 04 Nov 2009) Log Message: ----------- Move EDI directories to the company directory Removed Paths: ------------- trunk/EDI_Incoming_Orders/ trunk/EDI_Sent/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2009-11-07 20:17:27
|
Revision: 2893 http://web-erp.svn.sourceforge.net/web-erp/?rev=2893&view=rev Author: daintree Date: 2009-11-07 20:17:20 +0000 (Sat, 07 Nov 2009) Log Message: ----------- New Daily Sales Inquiry showing predictably the daily sales for a selected month and salesman Modified Paths: -------------- trunk/doc/Change.log.html trunk/includes/DateFunctions.inc trunk/sql/mysql/upgrade3.10-3.11.sql Added Paths: ----------- trunk/DailySalesInquiry.php Added: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php (rev 0) +++ trunk/DailySalesInquiry.php 2009-11-07 20:17:20 UTC (rev 2893) @@ -0,0 +1,166 @@ +<?php + +/* $Revision: 1.00$ */ + +$PageSecurity = 2; + +include('includes/session.inc'); +$title = _('Daily Sales Inquiry'); +include('includes/header.inc'); + +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/transactions.png" title="' . _('Daily Sales') . '" alt="">' . ' ' . _('Daily Sales') . '</p>'; +echo '<div class="page_help_text">' . _('Select the month to show daily sales for') . '</div><br>'; + +echo '<form action="' . $_SERVER['PHP_SELF'] . '" method="post">'; + +echo '<table cellpadding=2><tr>'; + +echo '<td>' . _('Month to Show') . ':</td><td><select tabindex=1 name="MonthToShow">'; + + +if (!isset($_POST['MonthToShow'])){ + $_POST['MonthToShow'] = GetPeriod(Date($_SESSION['DefaultDateFormat']),$db); +} + +$PeriodsResult = DB_query('SELECT periodno, lastdate_in_period FROM periods',$db); + +while ($PeriodRow = DB_fetch_array($PeriodsResult)){ + if ($_POST['MonthToShow']==$PeriodRow['periodno']) { + echo '<option selected Value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; + $EndDateSQL = $PeriodRow['lastdate_in_period']; + } else { + echo '<option Value="' . $PeriodRow['periodno'] . '">' . MonthAndYearFromSQLDate($PeriodRow['lastdate_in_period']) . '</option>'; + } +} +echo '</select></td>'; +echo '<td>' . _('Salesperson') . ':</td><td><select tabindex=2 name="Salesperson">'; + +$SalespeopleResult = DB_query('SELECT salesmancode, salesmanname FROM salesman',$db); +if (!isset($_POST['Salesperson'])){ + $_POST['Salesperson'] = 'All'; + echo '<option selected value="All">' . _('All') . '</option>'; +} else { + echo '<option value="All">' . _('All') . '</option>'; +} +while ($SalespersonRow = DB_fetch_array($SalespeopleResult)){ + + if ($_POST['Salesperson']==$SalespersonRow['salesmancode']) { + echo '<option selected value="' . $SalespersonRow['salesmancode'] . '">' . $SalespersonRow['salesmanname'] . '</option>'; + } else { + echo '<option Value="' . $SalespersonRow['salesmancode'] . '">' . $SalespersonRow['salesmanname'] . '</option>'; + } +} +echo '</select></td>'; + +echo '</tr></table><div class="centre"><input tabindex=4 type=submit name="ShowResults" VALUE="' . _('Show Daily Sales For The Selected Month') . '">'; +echo '<hr>'; + +echo '</form></div>'; +/*Now get and display the sales data returned */ +if (strpos($EndDateSQL,'/')) { + $Date_Array = explode('/',$EndDateSQL); +} elseif (strpos ($EndDateSQL,'-')) { + $Date_Array = explode('-',$EndDateSQL); +} elseif (strpos ($EndDateSQL,'.')) { + $Date_Array = explode('.',$EndDateSQL); +} + +if (strlen($Date_Array[2])>4) { + $Date_Array[2]= substr($Date_Array[2],0,2); +} + +$StartDateSQL = date('Y-m-d', mktime(0,0,0, (int)$Date_Array[1],1,(int)$Date_Array[0])); + +$sql = "SELECT trandate, + SUM((price*(1-discountpercent) * -qty)) as salesvalue, + SUM((standardcost * -qty)) as cost + FROM stockmoves + INNER JOIN custbranch ON stockmoves.debtorno=custbranch.debtorno + AND stockmoves.branchcode=custbranch.branchcode + WHERE (stockmoves.type=10 or stockmoves.type=11) + AND trandate>='" . $StartDateSQL . "' + AND trandate<='" . $EndDateSQL . "'"; + +if ($_POST['Salesperson']!='All') { + $sql .= " AND custbranch.salesman='" . $_POST['Salesperson'] . "'"; +} + +$sql .= " GROUP BY stockmoves.trandate ORDER BY stockmoves.trandate"; + +$ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db); +$SalesResult = DB_query($sql, $db,$ErrMsg,$DbgMsg); + +echo '<table cellpadding=2>'; + +echo'<tr> + <th>' . _('Sunday') . '</th> + <th>' . _('Monday') . '</th> + <th>' . _('Tuesday') . '</th> + <th>' . _('Wednesday') . '</th> + <th>' . _('Thursday') . '</th> + <th>' . _('Friday') . '</th> + <th>' . _('Saturday') . '</th></tr>'; + +$CumulativeTotalSales = 0; +$BilledDays = 0; +$DaySalesArray = array(); +while ($DaySalesRow=DB_fetch_array($SalesResult)) { + $DaySalesArray[DayOfMonthFromSQLDate($DaySalesRow['trandate'])]->Sales = $DaySalesRow['salesvalue']; + $DaySalesArray[DayOfMonthFromSQLDate($DaySalesRow['trandate'])]->GPPercent = ($DaySalesRow['salesvalue']-$DaySalesRow['cost'])/$DaySalesRow['salesvalue']; + $BilledDays++; + $CumulativeTotalSales += $DaySalesRow['salesvalue']; + $CumulativeTotalCost += $DaySalesRow['cost']; +} +//end of while loop +echo '<tr>'; +$ColumnCounter = DayOfWeekFromSQLDate($StartDateSQL); +for ($i=0;$i<$ColumnCounter;$i++){ + echo '<td></td>'; +} +$DayNumber = 1; +/*Set up day number headings*/ +for ($i=$ColumnCounter;$i<=6;$i++){ + echo '<th>' . $DayNumber . '</th>'; + $DayNumber++; +} +echo '</tr><tr>'; +for ($i=0;$i<$ColumnCounter;$i++){ + echo '<td></td>'; +} + +$LastDayOfMonth = DayOfMonthFromSQLDate($EndDateSQL); + +for ($i=1;$i<=$LastDayOfMonth;$i++){ + echo '<td class="number">' . number_format($DaySalesArray[$i]->Sales,0) . '<br />' . number_format($DaySalesArray[$i]->GPPercent*100,1) . '%</td>'; + $ColumnCounter++; + if ($ColumnCounter==7){ + echo '</tr><tr>'; + for ($j=1;$j<=7;$j++){ + echo '<th>' . $DayNumber . '</th>'; + $DayNumber++; + if($DayNumber>$LastDayOfMonth){ + break; + } + } + echo '</tr><tr>'; + $ColumnCounter=0; + } +} +if ($ColumnCounter!=0) { + echo '</tr><tr>'; +} + +if ($CumulativeTotalSales !=0){ + $AverageGPPercent = ($CumulativeTotalSales - $CumulativeTotalCost)/$CumulativeTotalSales; + $AverageDailySales = $CumulativeTotalSales/$BilledDays; +} else { + $AverageGPPercent = 0; + $AverageDailySales = 0; +} + +echo '<td colspan=7>' . _('Total Sales for month') . ': ' . number_format($CumulativeTotalSales,0) . ' ' . _('GP%') . ': ' . number_format($AverageGPPercent,1) . ' ' . _('Avg Daily Sales') . ': ' . number_format($AverageDailySales,0) . '</td></tr>'; + +echo '</table>'; + +include('includes/footer.inc'); +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-07 16:53:54 UTC (rev 2892) +++ trunk/doc/Change.log.html 2009-11-07 20:17:20 UTC (rev 2893) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>08/11/09 Phil: New DailySalesInquiry.php - show sales for a selected month - day by day with average sales per billing day and GP% - work sponsored by Manny Neri <p>07/11/09 Tim: PrintCstTransPortrait.php - Correct $pdf->Output() call to show invoice without saving first <p>07/11/09 Tim: upgrade3.11-3.12.sql - Remove duplicated line and corrected syntax for consistency <p>06/11/09 Javier: Added charset declaration to login.css and default.css Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2009-11-07 16:53:54 UTC (rev 2892) +++ trunk/includes/DateFunctions.inc 2009-11-07 20:17:20 UTC (rev 2893) @@ -104,7 +104,6 @@ function DayOfWeekFromSQLDate($DateEntry) { - if (strpos($DateEntry,'/')) { $Date_Array = explode('/',$DateEntry); } elseif (strpos ($DateEntry,'-')) { @@ -121,7 +120,25 @@ } +function DayOfMonthFromSQLDate($DateEntry) { + if (strpos($DateEntry,'/')) { + $Date_Array = explode('/',$DateEntry); + } elseif (strpos ($DateEntry,'-')) { + $Date_Array = explode('-',$DateEntry); + } elseif (strpos ($DateEntry,'.')) { + $Date_Array = explode('.',$DateEntry); + } + + if (strlen($Date_Array[2])>4) { + $Date_Array[2]= substr($Date_Array[2],0,2); + } + + return date( 'j', mktime(0,0,0, (int)$Date_Array[1],(int)$Date_Array[2],(int)$Date_Array[0])); + +} + + // Returns the timestamp for the financial year end. To find other year ends, // use $YearIncrement to move back and fgorward. in -1 gives last year end, 1 // gives next year end. Modified: trunk/sql/mysql/upgrade3.10-3.11.sql =================================================================== --- trunk/sql/mysql/upgrade3.10-3.11.sql 2009-11-07 16:53:54 UTC (rev 2892) +++ trunk/sql/mysql/upgrade3.10-3.11.sql 2009-11-07 20:17:20 UTC (rev 2893) @@ -1,4 +1,3 @@ ---Create `mrpdemandtypes` table CREATE TABLE `mrpdemandtypes` ( `mrpdemandtype` varchar(6) NOT NULL default '', `description` char(30) NOT NULL default '', @@ -6,7 +5,6 @@ KEY `mrpdemandtype` (`mrpdemandtype`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ---Create `mrpdemands` table CREATE TABLE `mrpdemands` ( `demandid` int(11) NOT NULL AUTO_INCREMENT, `stockid` varchar(20) NOT NULL default '', @@ -19,11 +17,9 @@ CONSTRAINT `mrpdemands_ibfk_2` FOREIGN KEY (`stockid`) REFERENCES `stockmaster` (`stockid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ---Add `pansize` and `shrinkfactor` columns to stockmaster table ALTER TABLE `stockmaster` ADD `pansize` double NOT NULL default '0', ADD `shrinkfactor` double NOT NULL default '0'; ---Create `mrpcalendar` table CREATE TABLE `mrpcalendar` ( calendardate date NOT NULL, daynumber int(6) NOT NULL, @@ -32,39 +28,21 @@ PRIMARY KEY (calendardate) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ---Add default value to `mrpdemandtypes` table + INSERT INTO mrpdemandtypes (mrpdemandtype,description) VALUES ('FOR','Forecast'); ---Add primary key to `geocode_param` table ALTER TABLE `geocode_param` add PRIMARY KEY (`geocodeid`); ---Alter definition of `geocodeid` field in `geocode_param` table ALTER TABLE `geocode_param` CHANGE `geocodeid` `geocodeid` TINYINT( 4 ) NOT NULL AUTO_INCREMENT; - ---Create a unique index in table `factorcompanies` for `coyname` field CREATE UNIQUE INDEX factor_name ON factorcompanies (coyname); ---Insert default value into `factorcompanies` table INSERT INTO `factorcompanies` ( `id` , `coyname` ) VALUES (null, 'None'); - ---Alter definition of `role` field in `custcontacts` table ALTER TABLE `custcontacts` CHANGE `role` `role` VARCHAR( 40 ) NOT NULL; ---Alter definition of `phoneno` field in `custcontacts` table ALTER TABLE `custcontacts` CHANGE `phoneno` `phoneno` VARCHAR( 20 ) NOT NULL; ---Alter definition of `notes` field in `custcontacts` table ALTER TABLE `custcontacts` CHANGE `notes` `notes` VARCHAR( 255 ) NOT NULL; - ---Set `effectivefrom` field to today in `purchdata` where no value currebtly exists UPDATE `purchdata` SET `effectivefrom`=NOW() WHERE `effectivefrom`='0000-00-00'; ---Drop the primary key in the `purchdata` table ALTER TABLE `purchdata` DROP PRIMARY KEY; ---Create a new primary key in the `purchdata` table ALTER TABLE `purchdata` ADD PRIMARY KEY (`supplierno`,`stockid`, `effectivefrom`); - ---Add `quotedate` field to `salesorders` table ALTER TABLE `salesorders` ADD `quotedate` date NOT NULL default '0000-00-00'; ---Add `confirmeddate` field to `salesorders` table ALTER TABLE `salesorders` ADD `confirmeddate` date NOT NULL default '0000-00-00'; - ---Create `woserialnos` table CREATE TABLE `woserialnos` ( `wo` INT NOT NULL , `stockid` VARCHAR( 20 ) NOT NULL , @@ -73,24 +51,13 @@ `qualitytext` TEXT NOT NULL, PRIMARY KEY (`wo`,`stockid`,`serialno`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - ---Create new config value 'AutoCreateWOs' INSERT INTO config (confname, confvalue) VALUES ('AutoCreateWOs',1); ---Create new config value 'DefaultFactoryLocation' INSERT INTO config (confname, confvalue) VALUES ('DefaultFactoryLocation','MEL'); ---Create new config value 'FactoryManagerEmail' INSERT INTO config (confname, confvalue) VALUES ('FactoryManagerEmail','ma...@co...'); ---Create new config value 'DefineControlledOnWOEntry' INSERT INTO config (`confname`,`confvalue`) VALUES ('DefineControlledOnWOEntry', '1'); - ---Add column`nextserialno` to `stockmaster` table ALTER TABLE `stockmaster` ADD `nextserialno` BIGINT NOT NULL DEFAULT '0'; ---Alter definition of column `orderno` in `salesorders` table ALTER TABLE `salesorders` CHANGE `orderno` `orderno` INT( 11 ) NOT NULL; ---Add column`qualitytext` to `stockserialitems` table ALTER TABLE `stockserialitems` ADD `qualitytext` TEXT NOT NULL; - ---Create table `purchorderauth` CREATE TABLE `purchorderauth` ( `userid` varchar(20) NOT NULL DEFAULT '', `currabrev` char(3) NOT NULL DEFAULT '', @@ -98,77 +65,35 @@ `authlevel` int(11) NOT NULL DEFAULT 0, PRIMARY KEY (`userid`,`currabrev`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - ---Add column`version` to `purchorders` table ALTER TABLE `purchorders` ADD `version` decimal(3,2) NOT NULL default '1.00'; ---Add column`revised` to `purchorders` table ALTER TABLE `purchorders` ADD `revised` date NOT NULL default '0000-00-00'; ---Add column`realorderno` to `purchorders` table ALTER TABLE `purchorders` ADD `realorderno` varchar(16) NOT NULL default ''; ---Add column`deliveryby` to `purchorders` table ALTER TABLE `purchorders` ADD `deliveryby` varchar(100) NOT NULL default ''; ---Add column`deliverydate` to `purchorders` table ALTER TABLE `purchorders` ADD `deliverydate` date NOT NULL default '0000-00-00'; ---Add column`status` to `purchorders` table ALTER TABLE `purchorders` ADD `status` varchar(12) NOT NULL default ''; ---Add column`stat_comment` to `purchorders` table ALTER TABLE `purchorders` ADD `stat_comment` text NOT NULL; - ---Add column`itemno` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `itemno` varchar(50) NOT NULL default ''; ---Add column`uom` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `uom` varchar(50) NOT NULL default ''; ---Add column`subtotal_amount` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `subtotal_amount` varchar(50) NOT NULL default ''; ---Add column`package` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `package` varchar(100) NOT NULL default ''; ---Add column`pcunit` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `pcunit` varchar(50) NOT NULL default ''; ---Add column`nw` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `nw` varchar(50) NOT NULL default ''; ---Add column`suppliers_partno` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `suppliers_partno` varchar(50) NOT NULL default ''; ---Add column`gw` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `gw` varchar(50) NOT NULL default ''; ---Add column`cuft` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `cuft` varchar(50) NOT NULL default ''; ---Add column`total_quantity` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `total_quantity` varchar(50) NOT NULL default ''; ---Add column`total_amount` to `purchorderdetails` table ALTER TABLE `purchorderdetails` ADD `total_amount` varchar(50) NOT NULL default ''; - ---Add column`phn` to `suppliers` table ALTER TABLE `suppliers` ADD `phn` varchar(50) NOT NULL default ''; ---Add column`port` to `suppliers` table ALTER TABLE `suppliers` ADD `port` varchar(200) NOT NULL default ''; - ---Add column`netweight` to `stockmaster` table ALTER TABLE `stockmaster` ADD `netweight` decimal(20,4) NOT NULL default '0.0000'; - ---Add column`suppliers_partno` to `purchdata` table ALTER TABLE `purchdata` ADD `suppliers_partno` varchar(50) NOT NULL default ''; - ---Set status of all orders to 'Authorised' UPDATE `purchorders` SET `status`='Authorised'; ---Change status of all orders where allowprint is not set to 'Printed' UPDATE `purchorders` SET `status`='Printed' WHERE `allowprint`=0; ---Change status of all orders which have been delivered to 'Completed' UPDATE `purchorders` SET `status`='Completed' WHERE (SELECT SUM(`purchorderdetails`.`completed`)-COUNT(`purchorderdetails`.`podetailitem`) FROM `purchorderdetails` where `purchorderdetails`.`orderno`=`purchorders`.`orderno`)=0; ---Set the delivery date of all orders to the latest line delivery date UPDATE `purchorders` SET `deliverydate`=(SELECT MAX(`purchorderdetails`.`deliverydate`) FROM `purchorderdetails` WHERE `purchorderdetails`.`orderno`=`purchorders`.`orderno`); - ---Alter definition of column `note` in `custnotes` table ALTER TABLE custnotes CHANGE note note TEXT NOT NULL; - ---Add column`bankaccountcode` to `bankaccounts` table ALTER TABLE `bankaccounts` ADD `bankaccountcode` varchar(50) NOT NULL default '' AFTER `currcode`; ---Add column`invoice` to `bankaccounts` table ALTER TABLE `bankaccounts` ADD `invoice` smallint(2) NOT NULL default 0 AFTER `currcode`; - ---Add column`salesman` to `www_users` table ALTER TABLE `www_users` ADD `salesman` CHAR( 3 ) NOT NULL AFTER `customerid`; - ---Alter definition of column `shipvia` in `debtortrans` table ALTER TABLE debtortrans CHANGE shipvia shipvia int(11) NOT NULL DEFAULT 0; - INSERT INTO `config` ( `confname` , `confvalue` ) VALUES ('SalesOrder_FOI', '0'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ja...@us...> - 2009-11-09 16:20:59
|
Revision: 2916 http://web-erp.svn.sourceforge.net/web-erp/?rev=2916&view=rev Author: javier7 Date: 2009-11-09 16:20:52 +0000 (Mon, 09 Nov 2009) Log Message: ----------- PO_Header.php - v1.33 Added gettext function at Line 544 and Id SVN Property. Modified Paths: -------------- trunk/PO_Header.php trunk/doc/Change.log.html Property Changed: ---------------- trunk/PO_Header.php Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2009-11-09 15:07:59 UTC (rev 2915) +++ trunk/PO_Header.php 2009-11-09 16:20:52 UTC (rev 2916) @@ -1,6 +1,7 @@ <?php -/* $Revision: 1.32 $ */ +/* $Id$ */ +/* $Revision: 1.33 $ */ /* * PO_Header.php @@ -538,8 +539,8 @@ $_SESSION['PO'.$identifier]->port = $_POST['port']; } else { prnMsg( _('You do not have the authority to raise Purchase Orders for '). - '<br>'.$SupplierName.'. '._('Please Consult your system administrator for more information').'. ' - ._('You can setup authorisations ').'<a href=PO_AuthorisationLevels.php>here: </a>', 'warn'); + $SupplierName.'. '._('Please Consult your system administrator for more information').'. ' + ._('You can setup authorisations ').'<a href=PO_AuthorisationLevels.php>'._('here:').' </a>', 'warn'); include('includes/footer.inc'); exit; } @@ -1144,4 +1145,4 @@ echo '</form>'; include('includes/footer.inc'); -?> \ No newline at end of file +?> Property changes on: trunk/PO_Header.php ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-09 15:07:59 UTC (rev 2915) +++ trunk/doc/Change.log.html 2009-11-09 16:20:52 UTC (rev 2916) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>09/11/09 Javier: PO_Header.php - v1.33 Added gettext function at Line 544 and Id SVN Property. <p>09/11/09 Javier: messages.pot - update of gettext en_GB template file for translations. <p>09/11/09 Javier: CustomerReceipt.php - v1.46 Add in Id SVN Property. <p>09/11/09 Javier: CustomerReceipt.php - v1.45 Removed br at Line 783 from html table first column title. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ja...@us...> - 2009-11-09 16:50:32
|
Revision: 2920 http://web-erp.svn.sourceforge.net/web-erp/?rev=2920&view=rev Author: javier7 Date: 2009-11-09 16:50:25 +0000 (Mon, 09 Nov 2009) Log Message: ----------- ConnectDB mysql, mysqli and postgres: Added SVN Property and Removed htmlspecialchars from function DB_escape_string. Modified Paths: -------------- trunk/doc/Change.log.html trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc trunk/includes/ConnectDB_postgres.inc Property Changed: ---------------- trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc trunk/includes/ConnectDB_postgres.inc Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-09 16:48:06 UTC (rev 2919) +++ trunk/doc/Change.log.html 2009-11-09 16:50:25 UTC (rev 2920) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>09/11/09 Javier: ConnectDB_mysql.inc v1.32 ConnectDB_mysqli.inc v1.21 and ConnectDB_postgres.inc v1.15 - Added Id and Removed htmlspecialchars at Line 139, 162 and 124 <p>09/11/09 Javier: PO_Header.php - v1.33 Added gettext function at Line 544 and Id SVN Property. <p>09/11/09 Javier: messages.pot - update of gettext en_GB template file for translations. <p>09/11/09 Javier: CustomerReceipt.php - v1.46 Add in Id SVN Property. Modified: trunk/includes/ConnectDB_mysql.inc =================================================================== --- trunk/includes/ConnectDB_mysql.inc 2009-11-09 16:48:06 UTC (rev 2919) +++ trunk/includes/ConnectDB_mysql.inc 2009-11-09 16:50:25 UTC (rev 2920) @@ -1,6 +1,7 @@ <?php -/* $Revision: 1.31 $ */ +/* $Id$ */ +/* $Revision: 1.32 $ */ define ('LIKE','LIKE'); @@ -136,7 +137,7 @@ } function DB_escape_string($String){ - return mysql_real_escape_string(htmlspecialchars($String, ENT_COMPAT, _('iso-8859-1'))); + return mysql_real_escape_string($String); } function DB_show_tables(&$Conn){ Property changes on: trunk/includes/ConnectDB_mysql.inc ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/includes/ConnectDB_mysqli.inc =================================================================== --- trunk/includes/ConnectDB_mysqli.inc 2009-11-09 16:48:06 UTC (rev 2919) +++ trunk/includes/ConnectDB_mysqli.inc 2009-11-09 16:50:25 UTC (rev 2920) @@ -1,6 +1,7 @@ <?php -/* $Revision: 1.20 $ */ +/* $Id$ */ +/* $Revision: 1.21 $ */ /* PeterMoulding.com 20071102 Change from mysql to mysqli; @@ -159,7 +160,7 @@ function DB_escape_string($String){ global $db; - return mysqli_real_escape_string($db, htmlspecialchars($String, ENT_COMPAT, _('iso-8859-1'))); + return mysqli_real_escape_string($db, $String); } function DB_show_tables(&$Conn){ Property changes on: trunk/includes/ConnectDB_mysqli.inc ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/includes/ConnectDB_postgres.inc =================================================================== --- trunk/includes/ConnectDB_postgres.inc 2009-11-09 16:48:06 UTC (rev 2919) +++ trunk/includes/ConnectDB_postgres.inc 2009-11-09 16:50:25 UTC (rev 2920) @@ -1,6 +1,7 @@ <?php -/* $Revision: 1.14 $ */ +/* $Id$ */ +/* $Revision: 1.15 $ */ define ('LIKE','ILIKE'); /* $PgConnStr = $PgConnStr = "host=".$host." dbname=".$_SESSION['DatabaseName']; */ @@ -121,7 +122,7 @@ } function DB_escape_string($String){ - Return pg_escape_string(htmlspecialchars($String, ENT_COMPAT, _('ISO-8859-1'))); + Return pg_escape_string($String); } function INTERVAL( $val, $Inter ) { Property changes on: trunk/includes/ConnectDB_postgres.inc ___________________________________________________________________ Added: svn:keywords + Id This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ja...@us...> - 2009-11-09 17:14:35
|
Revision: 2922 http://web-erp.svn.sourceforge.net/web-erp/?rev=2922&view=rev Author: javier7 Date: 2009-11-09 17:14:26 +0000 (Mon, 09 Nov 2009) Log Message: ----------- PO_Header.php - v1.34 - Replaced colon and space with period at Line 543. Modified Paths: -------------- trunk/PO_Header.php trunk/doc/Change.log.html Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2009-11-09 16:54:18 UTC (rev 2921) +++ trunk/PO_Header.php 2009-11-09 17:14:26 UTC (rev 2922) @@ -1,7 +1,7 @@ <?php /* $Id$ */ -/* $Revision: 1.33 $ */ +/* $Revision: 1.34 $ */ /* * PO_Header.php @@ -540,7 +540,7 @@ } else { prnMsg( _('You do not have the authority to raise Purchase Orders for '). $SupplierName.'. '._('Please Consult your system administrator for more information').'. ' - ._('You can setup authorisations ').'<a href=PO_AuthorisationLevels.php>'._('here:').' </a>', 'warn'); + ._('You can setup authorisations ').'<a href=PO_AuthorisationLevels.php>'._('here.').'</a>', 'warn'); include('includes/footer.inc'); exit; } Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-09 16:54:18 UTC (rev 2921) +++ trunk/doc/Change.log.html 2009-11-09 17:14:26 UTC (rev 2922) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>09/11/09 Javier: PO_Header.php - v1.34 - Replaced colon and space with period at Line 543. <p>09/11/09 Javier: ConnectDB_mysql.inc v1.32 ConnectDB_mysqli.inc v1.21 and ConnectDB_postgres.inc v1.15 - Added Id and Removed htmlspecialchars at Line 139, 162 and 124 <p>09/11/09 Javier: PO_Header.php - v1.33 Added gettext function at Line 544 and Id SVN Property. <p>09/11/09 Javier: messages.pot - update of gettext en_GB template file for translations. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-11 17:09:37
|
Revision: 2967 http://web-erp.svn.sourceforge.net/web-erp/?rev=2967&view=rev Author: tim_schofield Date: 2009-11-11 17:09:30 +0000 (Wed, 11 Nov 2009) Log Message: ----------- Improvements to purchase ordering system Modified Paths: -------------- trunk/PO_Header.php trunk/PO_Items.php trunk/includes/DefinePOClass.php trunk/includes/PO_ReadInOrder.inc trunk/sql/mysql/upgrade3.11-3.12.sql Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2009-11-11 13:00:00 UTC (rev 2966) +++ trunk/PO_Header.php 2009-11-11 17:09:30 UTC (rev 2967) @@ -242,6 +242,12 @@ $_SESSION['PO'.$identifier]->DelAdd4 = $_POST['DelAdd4']; $_SESSION['PO'.$identifier]->DelAdd5 = $_POST['DelAdd5']; $_SESSION['PO'.$identifier]->DelAdd6 = $_POST['DelAdd6']; + $_SESSION['PO'.$identifier]->suppDelAdd1 = $_POST['suppDelAdd1']; + $_SESSION['PO'.$identifier]->suppDelAdd2 = $_POST['suppDelAdd2']; + $_SESSION['PO'.$identifier]->suppDelAdd3 = $_POST['suppDelAdd3']; + $_SESSION['PO'.$identifier]->suppDelAdd4 = $_POST['suppDelAdd4']; + $_SESSION['PO'.$identifier]->suppDelAdd5 = $_POST['suppDelAdd5']; + $_SESSION['PO'.$identifier]->supptel= $_POST['supptel']; $_SESSION['PO'.$identifier]->Initiator = $_POST['Initiator']; $_SESSION['PO'.$identifier]->RequisitionNo = $_POST['Requisition']; $_SESSION['PO'.$identifier]->version = $_POST['version']; @@ -251,6 +257,10 @@ $_SESSION['PO'.$identifier]->Comments = $_POST['Comments']; $_SESSION['PO'.$identifier]->deliveryby = $_POST['deliveryby']; $_SESSION['PO'.$identifier]->StatusMessage = $_POST['StatComments']; + $_SESSION['PO'.$identifier]->paymentterms = $_POST['paymentterms']; + $_SESSION['PO'.$identifier]->contact = $_POST['Contact']; + $_SESSION['PO'.$identifier]->tel = $_POST['tel']; + $_SESSION['PO'.$identifier]->port = $_POST['port']; if (isset($_POST['RePrint']) and $_POST['RePrint']==1){ @@ -269,7 +279,9 @@ echo '<p>'; prnMsg(_('You should automatically be forwarded to the entry of the purchase order line items page') . '. ' . _('If this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . - "<a href='$rootpath/PO_Items.php?" . SID . "'>" . _('click here') . '</a> ' . _('to continue'),'info'); + "<a href='$rootpath/PO_Items.php?" . SID. 'identifier='.$identifier . "'>" . _('click here') . '</a> ' . _('to continue'),'info'); + include('includes/footer.inc'); + exit; } /* end of if isset _POST'EnterLines' */ echo '<a href="'. $rootpath . '/PO_SelectOSPurchOrder.php?' . SID . "identifier=".$identifier.'">'. _('Back to Purchase Orders'). '</a><br>'; @@ -465,6 +477,12 @@ $_POST['DelAdd4']=$_SESSION['PO'.$identifier]->DelAdd4; $_POST['DelAdd5']=$_SESSION['PO'.$identifier]->DelAdd5; $_POST['DelAdd6']=$_SESSION['PO'.$identifier]->DelAdd6; + $_POST['suppDelAdd1']=$_SESSION['PO'.$identifier]->suppDelAdd1; + $_POST['suppDelAdd2']=$_SESSION['PO'.$identifier]->suppDelAdd2; + $_POST['suppDelAdd3']=$_SESSION['PO'.$identifier]->suppDelAdd3; + $_POST['suppDelAdd4']=$_SESSION['PO'.$identifier]->suppDelAdd4; + $_POST['suppDelAdd5']=$_SESSION['PO'.$identifier]->suppDelAdd5; + $_POST['suppDelAdd6']=$_SESSION['PO'.$identifier]->suppDelAdd6; } @@ -509,7 +527,7 @@ $SupplierName = $myrow[0]; // added for suppliers lookup fields - if ($authmyrow=DB_fetch_array($authresult) and $authmyrow[0]==0) { + if (($authmyrow=DB_fetch_array($authresult) and $authmyrow[0]==0 ) ) { $_POST['SupplierName'] = $myrow[0]; $_POST['CurrCode'] = $myrow[1]; $_POST['ExRate'] = $myrow[2]; @@ -574,35 +592,35 @@ // added for suppliers lookup fields + if (!isset($_SESSION['PO'.$identifier])) { + $_POST['SupplierName'] = $myrow[0]; + $_POST['CurrCode'] = $myrow[1]; + $_POST['paymentterms']= $myrow[2]; + $_POST['suppDelAdd1'] = $myrow[3]; + $_POST['suppDelAdd2'] = $myrow[4]; + $_POST['suppDelAdd3'] = $myrow[5]; + $_POST['suppDelAdd4'] = $myrow[6]; + $_POST['suppDelAdd5'] = $myrow[7]; + $_POST['suppDelAdd6'] = $myrow[8]; + $_POST['supptel'] = $myrow[9]; + $_POST['port'] = $myrow[10]; - $_POST['SupplierName'] = $myrow[0]; - $_POST['CurrCode'] = $myrow[1]; -// $_POST['ExRate'] = $myrow[2]; - $_POST['paymentterms']= $myrow[2]; - $_POST['suppDelAdd1'] = $myrow[3]; - $_POST['suppDelAdd2'] = $myrow[4]; - $_POST['suppDelAdd3'] = $myrow[5]; - $_POST['suppDelAdd4'] = $myrow[6]; - $_POST['suppDelAdd5'] = $myrow[7]; - $_POST['suppDelAdd6'] = $myrow[8]; - $_POST['supptel'] = $myrow[9]; - $_POST['port'] = $myrow[10]; - - $_SESSION['PO'.$identifier]->SupplierID = $_POST['Select']; - $_SESSION['RequireSupplierSelection'] = 0; - $_SESSION['PO'.$identifier]->SupplierName = $_POST['SupplierName']; - $_SESSION['PO'.$identifier]->CurrCode = $_POST['CurrCode']; - $_SESSION['PO'.$identifier]->ExRate = $_POST['ExRate']; - $_SESSION['PO'.$identifier]->paymentterms = $_POST['paymentterms']; - $_SESSION['PO'.$identifier]->suppDelAdd1 = $_POST['suppDelAdd1']; - $_SESSION['PO'.$identifier]->suppDelAdd2 = $_POST['suppDelAdd2']; - $_SESSION['PO'.$identifier]->suppDelAdd3 = $_POST['suppDelAdd3']; - $_SESSION['PO'.$identifier]->suppDelAdd4 = $_POST['suppDelAdd4']; - $_SESSION['PO'.$identifier]->suppDelAdd5 = $_POST['suppDelAdd5']; - $_SESSION['PO'.$identifier]->suppDelAdd6 = $_POST['suppDelAdd6']; - $_SESSION['PO'.$identifier]->supptel = $_POST['supptel']; - $_SESSION['PO'.$identifier]->port = $_POST['port']; + $_SESSION['PO'.$identifier]->SupplierID = $_POST['Select']; + $_SESSION['RequireSupplierSelection'] = 0; + $_SESSION['PO'.$identifier]->SupplierName = $_POST['SupplierName']; + $_SESSION['PO'.$identifier]->CurrCode = $_POST['CurrCode']; + $_SESSION['PO'.$identifier]->ExRate = $_POST['ExRate']; + $_SESSION['PO'.$identifier]->paymentterms = $_POST['paymentterms']; + $_SESSION['PO'.$identifier]->suppDelAdd1 = $_POST['suppDelAdd1']; + $_SESSION['PO'.$identifier]->suppDelAdd2 = $_POST['suppDelAdd2']; + $_SESSION['PO'.$identifier]->suppDelAdd3 = $_POST['suppDelAdd3']; + $_SESSION['PO'.$identifier]->suppDelAdd4 = $_POST['suppDelAdd4']; + $_SESSION['PO'.$identifier]->suppDelAdd5 = $_POST['suppDelAdd5']; + $_SESSION['PO'.$identifier]->suppDelAdd6 = $_POST['suppDelAdd6']; + $_SESSION['PO'.$identifier]->supptel = $_POST['supptel']; + $_SESSION['PO'.$identifier]->port = $_POST['port']; // end of added for suppliers lookup fields + } } // MADE THE SUPPILERS BECOME SELECT MENU NOT BY SEARCHING By Hudson @2008/6/30 @@ -739,6 +757,7 @@ $_POST['ExRate']=$_SESSION['PO'.$identifier]->ExRate; $_POST['Comments']=$_SESSION['PO'.$identifier]->Comments; $_POST['deliveryby']=$_SESSION['PO'.$identifier]->deliveryby; + $_POST['paymentterms']=$_SESSION['PO'.$identifier]->paymentterms; } // move apart by Hudson @@ -937,7 +956,7 @@ $_POST['Contact'] = $LocnRow[7]; $_SESSION['PO'.$identifier]->Location= $_POST['StkLocation']; - $_SESSION['PO'.$identifier]->SupplierContact= $_POST['SupplierContact']; +// $_SESSION['PO'.$identifier]->SupplierContact= $_POST['SupplierContact']; $_SESSION['PO'.$identifier]->DelAdd1 = $_POST['DelAdd1']; $_SESSION['PO'.$identifier]->DelAdd2 = $_POST['DelAdd2']; $_SESSION['PO'.$identifier]->DelAdd3 = $_POST['DelAdd3']; @@ -1062,7 +1081,7 @@ while ( $SuppCoRow=DB_fetch_array($SuppCoResult)){ if ($_POST['SupplierContact'] == $SuppCoRow['contact'] OR ($_POST['SupplierContact']=='' - AND $SuppCoRow['contact']==$_SESSION['SupplierContact'])){ + AND $SuppCoRow['contact']==$_SESSION['PO'.$identifier]->SupplierContact)){ //if (1) { echo "<option selected value='" . $SuppCoRow['contact'] . "'>" . $SuppCoRow['contact']; } else { @@ -1089,12 +1108,12 @@ </td><td><input type='text' name=suppDelAdd4 size=41 maxlength=40 value='" . $_POST['suppDelAdd4'] . "'></td> </tr>"; echo '<tr><td>' . _('Phone') . ": - </td><td><input type='text' name=supptel size=31 maxlength=30 value='" . $_POST['supptel'] . "'></td> + </td><td><input type='text' name=supptel size=31 maxlength=30 value='" . $_SESSION['PO'.$identifier]->supptel . "'></td> </tr>"; $result=DB_query('SELECT terms, termsindicator FROM paymentterms', $db); - echo '<tr><td>' . _('Payment Terms') . ":</td><td><select name='PaymentTerms'>"; + echo '<tr><td>' . _('Payment Terms') . ":</td><td><select name='paymentterms'>"; while ($myrow = DB_fetch_array($result)) { if ($myrow['termsindicator']==$_SESSION['PO'.$identifier]->paymentterms) { @@ -1106,7 +1125,7 @@ DB_data_seek($result, 0); echo '</select></td></tr>'; - $result=DB_query("SELECT loccode, locationname FROM locations WHERE loccode='" . $_POST['port'] ."'", $db); + $result=DB_query("SELECT loccode, locationname FROM locations WHERE loccode='" . $_SESSION['PO'.$identifier]->port."'", $db); $myrow = DB_fetch_array($result); $_POST['port'] = $myrow['locationname']; Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2009-11-11 13:00:00 UTC (rev 2966) +++ trunk/PO_Items.php 2009-11-11 17:09:30 UTC (rev 2967) @@ -125,13 +125,24 @@ deladd4, deladd5, deladd6, + tel, + suppdeladdress1, + suppdeladdress2, + suppdeladdress3, + suppdeladdress4, + suppdeladdress5, + suppdeladdress6, + suppliercontact, + supptel, + contact, version, realorderno, revised, deliveryby, status, stat_comment, - deliverydate) + deliverydate, + paymentterms) VALUES(" . $_SESSION['PO'.$identifier]->OrderNo . ", '" . $_SESSION['PO'.$identifier]->SupplierID . "', '" . $_SESSION['PO'.$identifier]->Comments . "', @@ -146,13 +157,23 @@ '" . $_SESSION['PO'.$identifier]->DelAdd4 . "', '" . $_SESSION['PO'.$identifier]->DelAdd5 . "', '" . $_SESSION['PO'.$identifier]->DelAdd6 . "', + '" . $_SESSION['PO'.$identifier]->tel . "', + '" . $_SESSION['PO'.$identifier]->suppDelAdd1 . "', + '" . $_SESSION['PO'.$identifier]->suppDelAdd2 . "', + '" . $_SESSION['PO'.$identifier]->suppDelAdd3 . "', + '" . $_SESSION['PO'.$identifier]->suppDelAdd4 . "', + '" . $_SESSION['PO'.$identifier]->suppDelAdd5 . "', + '" . $_SESSION['PO'.$identifier]->suppDelAdd6 . "', + '" . $_SESSION['PO'.$identifier]->SupplierContact . "', + '" . $_SESSION['PO'.$identifier]->supptel. "', + '" . $_SESSION['PO'.$identifier]->contact . "', '" . $_SESSION['PO'.$identifier]->version . "', - '" . $_SESSION['PO'.$identifier]->OrderNo2 . "', '" . FormatDateForSQL($date) . "', '" . $_SESSION['PO'.$identifier]->deliveryby . "', '" . 'Pending' . "', '" . $StatusComment . "', - '" . FormatDateForSQL($_SESSION['PO'.$identifier]->deliverydate) . "' + '" . FormatDateForSQL($_SESSION['PO'.$identifier]->deliverydate) . "', + '" . $_SESSION['PO'.$identifier]->paymentterms. "' )"; $ErrMsg = _('The purchase order header record could not be inserted into the database because'); @@ -237,6 +258,17 @@ deladd4='" . $_SESSION['PO'.$identifier]->DelAdd4 . "', deladd5='" . $_SESSION['PO'.$identifier]->DelAdd5 . "', deladd6='" . $_SESSION['PO'.$identifier]->DelAdd6 . "', + deladd6='" . $_SESSION['PO'.$identifier]->tel . "', + suppdeladdress1='" . $_SESSION['PO'.$identifier]->suppDelAdd1 . "', + suppdeladdress2='" . $_SESSION['PO'.$identifier]->suppDelAdd2 . "', + suppdeladdress3='" . $_SESSION['PO'.$identifier]->suppDelAdd3 . "', + suppdeladdress4='" . $_SESSION['PO'.$identifier]->suppDelAdd4 . "', + suppdeladdress5='" . $_SESSION['PO'.$identifier]->suppDelAdd5 . "', + suppdeladdress6='" . $_SESSION['PO'.$identifier]->suppDelAdd6 . "', + suppliercontact='" . $_SESSION['PO'.$identifier]->SupplierContact . "', + supptel='" . $_SESSION['PO'.$identifier]->supptel . "', + contact='" . $_SESSION['PO'.$identifier]->contact . "', + paymentterms='" . $_SESSION['PO'.$identifier]->paymentterms . "', allowprint=" . $_SESSION['PO'.$identifier]->AllowPrintPO . " WHERE orderno = '" . $_SESSION['PO'.$identifier]->OrderNo ."'"; @@ -494,7 +526,7 @@ /* Always do the stuff below if not looking for a supplierid */ if(isset($_GET['Delete'])){ - if($_SESSION['PO'.$identifier]->Some_Already_Received($_POST['LineNo'])==0){ + if($_SESSION['PO'.$identifier]->Some_Already_Received($_GET['Delete'])==0){ $_SESSION['PO'.$identifier]->LineItems[$_GET['Delete']]->Deleted=True; include ('includes/PO_UnsetFormVbls.php'); } else { @@ -764,7 +796,7 @@ $result1 = DB_query($sql,$db,$ErrMsg,$DbgMsg); if ($myrow = DB_fetch_array($result1)){ - if (is_numeric($myrow['price'])){ + if (isset($myrow['price']) and is_numeric($myrow['price'])){ $_SESSION['PO'.$identifier]->add_to_order ($_SESSION['PO'.$identifier]->LinesOnOrder+1, $ItemCode, @@ -993,6 +1025,9 @@ } } + unset($_POST['Keywords']); + unset($_POST['StockCode']); + if (!isset($_POST['Keywords'])) { $_POST['Keywords']=''; } @@ -1001,8 +1036,6 @@ $_POST['StockCode']=''; } - unset($_POST['Keywords']); - unset($_POST['StockCode']); echo '</select></td> <td><font size=2>' . _('Enter text extracts in the description') . ":</font></td> <td><input type='text' name='Keywords' size=20 maxlength=25 value='" . $_POST['Keywords'] . "'></td></tr> Modified: trunk/includes/DefinePOClass.php =================================================================== --- trunk/includes/DefinePOClass.php 2009-11-11 13:00:00 UTC (rev 2966) +++ trunk/includes/DefinePOClass.php 2009-11-11 17:09:30 UTC (rev 2967) @@ -1,4 +1,5 @@ <?php +/* $Id$ */ /* $Revision: 1.15 $ */ /* Definition of the PurchOrder class to hold all the information for a purchase order and delivery */ @@ -17,6 +18,15 @@ var $DelAdd4; var $DelAdd5; var $DelAdd6; + var $tel; + var $suppDelAdd1; + var $suppDelAdd2; + var $suppDelAdd3; + var $suppDelAdd4; + var $suppDelAdd5; + var $suppDelAdd6; + var $SupplierContact; + var $supptel; var $Comments; var $Location; Var $Managed; @@ -35,6 +45,9 @@ var $AllowPrintPO; var $revised; var $deliveryby; + var $paymentterms; + var $contact; + var $port; function PurchOrder(){ /*Constructor function initialises a new purchase order object */ @@ -171,8 +184,8 @@ function Some_Already_Received($LineNo){ /* Checks if there have been deliveries or amounts invoiced against a specific line item */ - if (count($this->LineItems)>0){ - if ($this->LineItems[$LineNo]->QtyReceived !=0 || $this->LineItems[$LineNo]->QtyInvoiced !=0){ + if (count($this->LineItems)>0 and isset($this->LineItems[$LineNo])){ + if ($this->LineItems[$LineNo]->QtyReceived !=0 or $this->LineItems[$LineNo]->QtyInv !=0){ return 1; } } @@ -297,4 +310,4 @@ } } -?> +?> \ No newline at end of file Modified: trunk/includes/PO_ReadInOrder.inc =================================================================== --- trunk/includes/PO_ReadInOrder.inc 2009-11-11 13:00:00 UTC (rev 2966) +++ trunk/includes/PO_ReadInOrder.inc 2009-11-11 17:09:30 UTC (rev 2967) @@ -1,4 +1,5 @@ <?php +/* $Id$ */ /* $Revision: 1.16 $ */ /*PO_ReadInOrder.inc is used by the modify existing order code in PO_Header.php and also by GoodsReceived.php */ @@ -27,6 +28,16 @@ purchorders.deladd4, purchorders.deladd5, purchorders.deladd6, + purchorders.tel, + purchorders.suppdeladdress1, + purchorders.suppdeladdress2, + purchorders.suppdeladdress3, + purchorders.suppdeladdress4, + purchorders.suppdeladdress5, + purchorders.suppdeladdress6, + purchorders.suppliercontact, + purchorders.supptel, + purchorders.contact, purchorders.allowprint, purchorders.requisitionno, purchorders.intostocklocation, @@ -35,8 +46,10 @@ purchorders.status, purchorders.stat_comment, purchorders.deliverydate, + purchorders.port, suppliers.currcode, - locations.managed + locations.managed , + purchorders.paymentterms FROM purchorders LEFT JOIN locations ON purchorders.intostocklocation=locations.loccode, suppliers @@ -47,34 +60,70 @@ $DbgMsg = _('The SQL statement that was used and failed was'); $GetOrdHdrResult = DB_query($OrderHeaderSQL,$db,$ErrMsg,$DbgMsg); - if (DB_num_rows($GetOrdHdrResult)==1) { + if (DB_num_rows($GetOrdHdrResult)==1 and !isset($_SESSION['PO'.$identifier]->OrderNo )) { - $myrow = DB_fetch_array($GetOrdHdrResult); - $_SESSION['PO'.$identifier]->OrderNo = $_GET['ModifyOrderNumber']; - $_SESSION['PO'.$identifier]->SupplierID = $myrow['supplierno']; - $_SESSION['PO'.$identifier]->SupplierName = $myrow['suppname']; - $_SESSION['PO'.$identifier]->CurrCode = $myrow['currcode']; - $_SESSION['PO'.$identifier]->Orig_OrderDate = $myrow['orddate']; - $_SESSION['PO'.$identifier]->AllowPrintPO = $myrow['allowprint']; - $_SESSION['PO'.$identifier]->DatePurchaseOrderPrinted = $myrow['dateprinted']; - $_SESSION['PO'.$identifier]->Comments = $myrow['comments']; - $_SESSION['PO'.$identifier]->ExRate = $myrow['rate']; - $_SESSION['PO'.$identifier]->Location = $myrow['intostocklocation']; - $_SESSION['PO'.$identifier]->Initiator = $myrow['initiator']; - $_SESSION['PO'.$identifier]->RequisitionNo = $myrow['requisitionno']; - $_SESSION['PO'.$identifier]->DelAdd1 = $myrow['deladd1']; - $_SESSION['PO'.$identifier]->DelAdd2 = $myrow['deladd2']; - $_SESSION['PO'.$identifier]->DelAdd3 = $myrow['deladd3']; - $_SESSION['PO'.$identifier]->DelAdd4 = $myrow['deladd4']; - $_SESSION['PO'.$identifier]->DelAdd5 = $myrow['deladd5']; - $_SESSION['PO'.$identifier]->DelAdd6 = $myrow['deladd6']; - $_SESSION['PO'.$identifier]->Managed = $myrow['managed']; + $myrow = DB_fetch_array($GetOrdHdrResult); + $_SESSION['PO'.$identifier]->OrderNo = $_GET['ModifyOrderNumber']; + $_SESSION['PO'.$identifier]->SupplierID = $myrow['supplierno']; + $_SESSION['PO'.$identifier]->SupplierName = $myrow['suppname']; + $_SESSION['PO'.$identifier]->CurrCode = $myrow['currcode']; + $_SESSION['PO'.$identifier]->Orig_OrderDate = $myrow['orddate']; + $_SESSION['PO'.$identifier]->AllowPrintPO = $myrow['allowprint']; + $_SESSION['PO'.$identifier]->DatePurchaseOrderPrinted = $myrow['dateprinted']; + $_SESSION['PO'.$identifier]->Comments = $myrow['comments']; + $_SESSION['PO'.$identifier]->ExRate = $myrow['rate']; + $_SESSION['PO'.$identifier]->Location = $myrow['intostocklocation']; + $_SESSION['PO'.$identifier]->Initiator = $myrow['initiator']; + $_SESSION['PO'.$identifier]->RequisitionNo = $myrow['requisitionno']; + $_SESSION['PO'.$identifier]->DelAdd1 = $myrow['deladd1']; + $_SESSION['PO'.$identifier]->DelAdd2 = $myrow['deladd2']; + $_SESSION['PO'.$identifier]->DelAdd3 = $myrow['deladd3']; + $_SESSION['PO'.$identifier]->DelAdd4 = $myrow['deladd4']; + $_SESSION['PO'.$identifier]->DelAdd5 = $myrow['deladd5']; + $_SESSION['PO'.$identifier]->DelAdd6 = $myrow['deladd6']; + $_SESSION['PO'.$identifier]->tel = $myrow['tel']; + $_SESSION['PO'.$identifier]->suppDelAdd1 = $myrow['suppdeladdress1']; + $_SESSION['PO'.$identifier]->suppDelAdd2 = $myrow['suppdeladdress2']; + $_SESSION['PO'.$identifier]->suppDelAdd3 = $myrow['suppdeladdress3']; + $_SESSION['PO'.$identifier]->suppDelAdd4 = $myrow['suppdeladdress4']; + $_SESSION['PO'.$identifier]->suppDelAdd5 = $myrow['suppdeladdress5']; + $_SESSION['PO'.$identifier]->suppDelAdd6 = $myrow['suppdeladdress6']; + $_SESSION['PO'.$identifier]->SupplierContact = $myrow['suppliercontact']; + $_SESSION['PO'.$identifier]->supptel= $myrow['supptel']; + $_SESSION['PO'.$identifier]->contact = $myrow['contact']; + $_SESSION['PO'.$identifier]->Managed = $myrow['managed']; $_SESSION['PO'.$identifier]->version = $myrow['version']; + $_SESSION['PO'.$identifier]->port = $myrow['port']; $_SESSION['PO'.$identifier]->Stat = $myrow['status']; $_SESSION['PO'.$identifier]->StatComments = $myrow['stat_comment']; $_SESSION['PO'.$identifier]->deliverydate = ConvertSQLDate($myrow['deliverydate']); $_SESSION['ExistingOrder'] = $_SESSION['PO'.$identifier]->OrderNo; - + $_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"; + + $ErrMsg = _('The searched supplier records requested cannot be retrieved because'); + $result_SuppSelect = DB_query($supplierSQL,$db,$ErrMsg); + + if (DB_num_rows($result_SuppSelect)==1){ + $myrow=DB_fetch_array($result_SuppSelect); +// $_POST['Select'] = $myrow['supplierid']; + } elseif (DB_num_rows($result_SuppSelect)==0){ + prnMsg( _('No supplier records contain the selected text') . ' - ' . + _('please alter your search criteria and try again'),'info'); + } + /*now populate the line PO array with the purchase order details records */ $LineItemsSQL = 'SELECT podetailitem, Modified: trunk/sql/mysql/upgrade3.11-3.12.sql =================================================================== --- trunk/sql/mysql/upgrade3.11-3.12.sql 2009-11-11 13:00:00 UTC (rev 2966) +++ trunk/sql/mysql/upgrade3.11-3.12.sql 2009-11-11 17:09:30 UTC (rev 2967) @@ -27,3 +27,15 @@ ALTER TABLE `holdreasons` DROP INDEX `ReasonCode`; ALTER TABLE `chartmaster` DROP INDEX `AccountCode`; + +ALTER TABLE `purchorders` ADD COLUMN `paymentterms` char(2) NOT NULL DEFAULT ''; +ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress1` varchar(40) NOT NULL DEFAULT '' AFTER deladd6; +ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress2` varchar(40) NOT NULL DEFAULT '' AFTER suppdeladdress1; +ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress3` varchar(40) NOT NULL DEFAULT '' AFTER suppdeladdress2; +ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress4` varchar(40) NOT NULL DEFAULT '' AFTER suppdeladdress3; +ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress5` varchar(20) NOT NULL DEFAULT '' AFTER suppdeladdress4; +ALTER TABLE `purchorders` ADD COLUMN `suppdeladdress6` varchar(15) NOT NULL DEFAULT '' AFTER suppdeladdress5; +ALTER TABLE `purchorders` ADD COLUMN `suppliercontact` varchar(30) NOT NULL DEFAULT '' AFTER suppdeladdress6; +ALTER TABLE `purchorders` ADD COLUMN `supptel` varchar(30) NOT NULL DEFAULT '' AFTER suppliercontact; +ALTER TABLE `purchorders` ADD COLUMN `tel` varchar(15) NOT NULL DEFAULT '' AFTER deladd6; +ALTER TABLE `purchorders` ADD COLUMN `port` varchar(40) NOT NULL DEFAULT '' ; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-12 12:30:33
|
Revision: 2982 http://web-erp.svn.sourceforge.net/web-erp/?rev=2982&view=rev Author: tim_schofield Date: 2009-11-12 12:30:20 +0000 (Thu, 12 Nov 2009) Log Message: ----------- api_php.php - include sqlcommonfunctions. api_salesorders.php - Fix call to GtNextTransaction() Modified Paths: -------------- branches/3.11-stable/api/api_php.php branches/3.11-stable/api/api_salesorders.php branches/3.11-stable/doc/Change.log.html trunk/api/api_php.php trunk/api/api_salesorders.php trunk/doc/Change.log.html trunk/includes/phplot/phplot.php trunk/includes/phplot/phplot_data.php Added Paths: ----------- trunk/ReportBug.php Property Changed: ---------------- trunk/includes/DefinePOClass.php Modified: branches/3.11-stable/api/api_php.php =================================================================== --- branches/3.11-stable/api/api_php.php 2009-11-12 12:16:52 UTC (rev 2981) +++ branches/3.11-stable/api/api_php.php 2009-11-12 12:30:20 UTC (rev 2982) @@ -9,6 +9,8 @@ $_SESSION['db']=$db; include 'api_errorcodes.php'; + /* Include SQL_CommonFunctions.inc, to use GetNextTransNo().*/ + include($PathPrefix.'includes/SQL_CommonFunctions.inc'); /* Get weberp authentication, and return a valid database connection */ Modified: branches/3.11-stable/api/api_salesorders.php =================================================================== --- branches/3.11-stable/api/api_salesorders.php 2009-11-12 12:16:52 UTC (rev 2981) +++ branches/3.11-stable/api/api_salesorders.php 2009-11-12 12:30:20 UTC (rev 2982) @@ -329,7 +329,7 @@ } $FieldNames=''; $FieldValues=''; - $OrderHeader['orderno'] = GetNextTransNo(30); + $OrderHeader['orderno'] = GetNextTransNo(30,$db); foreach ($OrderHeader as $key => $value) { $FieldNames.=$key.', '; $FieldValues.='"'.$value.'", '; Modified: branches/3.11-stable/doc/Change.log.html =================================================================== --- branches/3.11-stable/doc/Change.log.html 2009-11-12 12:16:52 UTC (rev 2981) +++ branches/3.11-stable/doc/Change.log.html 2009-11-12 12:30:20 UTC (rev 2982) @@ -1,5 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>12/11/09 Tim: api_php.php - include sqlcommonfunctions. +<p>12/11/09 Tim: api_salesorders.php - Fix call to GtNextTransaction() <p>12/11/09 CSRBusiness: api_salesorders.php - Correct the number of parameters in call to VerifyDeliveryDate() <p>12/11/09 Bryan Nielsen: BankAccounts.php - Correctly assign values to Yes and No options. <p>12/11/09 Tim: TaxProvinces.php - Correctly check if any locations use this province before deletion. Added: trunk/ReportBug.php =================================================================== --- trunk/ReportBug.php (rev 0) +++ trunk/ReportBug.php 2009-11-12 12:30:20 UTC (rev 2982) @@ -0,0 +1,26 @@ +<?php + +$PageSecurity = 15; +include('includes/session.inc'); +$title = _('Create trac item for bugs'); + +include 'xmlrpc/lib/xmlrpc.inc'; +include('includes/header.inc'); + + +$ServerURL = "https://sourceforge.net/apps/trac/web-erp/"; +$DebugLevel = 2; //Set to 0,1, or 2 with 2 being the highest level of debug info + +$msg = new xmlrpcmsg("system.listMethods", array()); + +$client = new xmlrpc_client($ServerURL); +$client->setDebug($DebugLevel); + +$response = $client->send($msg); + +$answer = php_xmlrpc_decode($response->value()); + +echo $answer; + +include('includes/footer.inc'); +?> \ No newline at end of file Modified: trunk/api/api_php.php =================================================================== --- trunk/api/api_php.php 2009-11-12 12:16:52 UTC (rev 2981) +++ trunk/api/api_php.php 2009-11-12 12:30:20 UTC (rev 2982) @@ -9,6 +9,8 @@ $_SESSION['db']=$db; include 'api_errorcodes.php'; + /* Include SQL_CommonFunctions.inc, to use GetNextTransNo().*/ + include($PathPrefix.'includes/SQL_CommonFunctions.inc'); /* Get weberp authentication, and return a valid database connection */ Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2009-11-12 12:16:52 UTC (rev 2981) +++ trunk/api/api_salesorders.php 2009-11-12 12:30:20 UTC (rev 2982) @@ -329,7 +329,7 @@ } $FieldNames=''; $FieldValues=''; - $OrderHeader['orderno'] = GetNextTransNo(30); + $OrderHeader['orderno'] = GetNextTransNo(30,$db); foreach ($OrderHeader as $key => $value) { $FieldNames.=$key.', '; $FieldValues.='"'.$value.'", '; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-12 12:16:52 UTC (rev 2981) +++ trunk/doc/Change.log.html 2009-11-12 12:30:20 UTC (rev 2982) @@ -1,5 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>12/11/09 Tim: api_php.php - include sqlcommonfunctions. +<p>12/11/09 Tim: api_salesorders.php - Fix call to GtNextTransaction() <p>12/11/09 CSRBusiness: api_salesorders.php - Correct the number of parameters in call to VerifyDeliveryDate() <p>12/11/09 Bryan Nielsen: BankAccounts.php - Correctly assign values to Yes and No options. <p>12/11/09 Tim: TaxProvinces.php - Correctly check if any locations use this province before deletion. Property changes on: trunk/includes/DefinePOClass.php ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/includes/phplot/phplot.php =================================================================== --- trunk/includes/phplot/phplot.php 2009-11-12 12:16:52 UTC (rev 2981) +++ trunk/includes/phplot/phplot.php 2009-11-12 12:30:20 UTC (rev 2982) @@ -1,6 +1,6 @@ <?php -/* $Id: phplot.php,v 1.1 2005-10-25 08:13:53 daintree Exp $ */ +/* $Id: phplot.php,v 1.1 2005/10/25 08:13:53 daintree Exp $ */ /* * PHPLOT Version 5.0.rc1 Modified: trunk/includes/phplot/phplot_data.php =================================================================== --- trunk/includes/phplot/phplot_data.php 2009-11-12 12:16:52 UTC (rev 2981) +++ trunk/includes/phplot/phplot_data.php 2009-11-12 12:30:20 UTC (rev 2982) @@ -1,5 +1,5 @@ <?php -/* $Id: phplot_data.php,v 1.1 2005-10-25 08:13:53 daintree Exp $ +/* $Id: phplot_data.php,v 1.1 2005/10/25 08:13:53 daintree Exp $ * * Copyright (C) 2000 Afan Ottenheimer. Released under * the GPL and PHP licenses as stated in the the README file which This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-12 12:59:50
|
Revision: 2985 http://web-erp.svn.sourceforge.net/web-erp/?rev=2985&view=rev Author: tim_schofield Date: 2009-11-12 12:59:44 +0000 (Thu, 12 Nov 2009) Log Message: ----------- Correct error in sql reventing a new order being raised Modified Paths: -------------- trunk/PO_Items.php trunk/doc/Change.log.html Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2009-11-12 12:45:38 UTC (rev 2984) +++ trunk/PO_Items.php 2009-11-12 12:59:44 UTC (rev 2985) @@ -136,7 +136,6 @@ supptel, contact, version, - realorderno, revised, deliveryby, status, Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-12 12:45:38 UTC (rev 2984) +++ trunk/doc/Change.log.html 2009-11-12 12:59:44 UTC (rev 2985) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>12/11/09 Tim: PO_Items.php - Correct error in sql reventing a new order being raised <p>12/11/09 Tim: apa_branches.php - Remove echo statement from modifybranch() function <p>12/11/09 Tim: api_php.php - include sqlcommonfunctions. <p>12/11/09 Tim: api_salesorders.php - Fix call to GtNextTransaction() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-14 10:31:24
|
Revision: 2996 http://web-erp.svn.sourceforge.net/web-erp/?rev=2996&view=rev Author: tim_schofield Date: 2009-11-14 10:31:14 +0000 (Sat, 14 Nov 2009) Log Message: ----------- Improve direct ordering code and make the EOQ the default quantity when ordered direct Modified Paths: -------------- trunk/PO_Header.php trunk/PO_Items.php trunk/SelectProduct.php Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2009-11-13 19:11:18 UTC (rev 2995) +++ trunk/PO_Header.php 2009-11-14 10:31:14 UTC (rev 2996) @@ -728,10 +728,76 @@ echo '<br><table class="table_index"><tr><td class="menu_group_item">'; /* the link */ - echo '<li><a href="'.$rootpath.'/PO_Items.php?' . SID . 'NewItem=' . $purch_item . "?identifier=".$identifier. '">' . + echo '<li><a href="'.$rootpath.'/PO_Items.php?' . SID . 'NewItem=' . $purch_item . "&identifier=".$identifier. '">' . _('Enter Line Item to this purchase order') . '</a></li>'; /**/ echo "</td></tr></table></div><br>"; + + if (isset($_GET['Quantity'])) { + $Qty=$_GET['Quantity']; + } else { + $Qty=1; + } + + $sql='SELECT + controlled, + serialised, + description, + units , + decimalplaces + FROM stockmaster + WHERE stockid="'.$purch_item.'" '; + $result=DB_query($sql, $db); + $stockmasterrow=DB_fetch_array($result); + + $sql='SELECT + price, + suppliersuom, + suppliers_partno + FROM purchdata + WHERE supplierno="'.$_GET['SelectedSupplier'] .'" + AND stockid="'.$purch_item.'" '; + $result=DB_query($sql, $db); + $purchdatarow=DB_fetch_array($result); + + $sql='SELECT + stockact + FROM stockcategory + LEFT JOIN stockmaster ON stockmaster.categoryid=stockcategory.categoryid + WHERE stockid="'.$purch_item.'" '; + $result=DB_query($sql, $db); + $categoryrow=DB_fetch_array($result); + + $_SESSION['PO'.$identifier]->add_to_order( + 1, + $purch_item, + $stockmasterrow['serialised'], + $stockmasterrow['controlled'], + $Qty, + $stockmasterrow['description'], + $purchdatarow['price'], + $stockmasterrow['units'], + $categoryrow['stockact'], + date($_SESSION['DefaultDateFormat']), + 0, + 0, + '', + 0, + 0, + '', + $stockmasterrow['decimalplaces'], + $purch_item, + $purchdatarow['suppliersuom'], + $purchdatarow['suppliers_partno'], + $Qty*$purchdatarow['price'], + '', + 0, + 0, + 0, + 0, + $Qty, + $Qty*$purchdatarow['price']); + echo "<meta http-equiv='Refresh' content='0; url=" . $rootpath . '/PO_Items.php?' . SID . 'identifier='.$identifier. "'>"; } /*Set up form for entry of order header stuff */ Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2009-11-13 19:11:18 UTC (rev 2995) +++ trunk/PO_Items.php 2009-11-14 10:31:14 UTC (rev 2996) @@ -883,7 +883,7 @@ if (count($_SESSION['PO'.$identifier]->LineItems)>0 and !isset($_GET['Edit'])){ echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . - _('Purchase Order') . '" alt="">'; + _('Purchase Order') . '" alt=""> '.$_SESSION['PO'.$identifier]->SupplierName; if (isset($_SESSION['PO'.$identifier]->OrderNo)) { echo ' ' . _('Purchase Order') .' '. $_SESSION['PO'.$identifier]->OrderNo ; Modified: trunk/SelectProduct.php =================================================================== --- trunk/SelectProduct.php 2009-11-13 19:11:18 UTC (rev 2995) +++ trunk/SelectProduct.php 2009-11-14 10:31:14 UTC (rev 2996) @@ -800,7 +800,12 @@ while ($SuppRow = DB_fetch_array($SuppResult)) { /**/ // - echo '<a href="' . $rootpath . '/PO_Header.php?' . SID . '&NewOrder=Yes' . '&SelectedSupplier=' . $SuppRow['supplierid'] . '&StockID=' . $StockID . '">' . _('Purchase this Item from') . ' ' . $SuppRow['suppname'] . ' (default)</a><br>'; + if ($myrow['eoq']==0) { + $EOQ=1; + } else { + $EOQ=$myrow['eoq']; + } + echo '<a href="' . $rootpath . '/PO_Header.php?' . SID . '&NewOrder=Yes' . '&SelectedSupplier=' . $SuppRow['supplierid'] . '&StockID=' . $StockID . '&Quantity='.$EOQ.'">' . _('Purchase this Item from') . ' ' . $SuppRow['suppname'] . ' (default)</a><br>'; /**/ } /* end of while */ } /* end of $myrow['mbflag'] == 'B' */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dai...@us...> - 2009-11-15 06:31:06
|
Revision: 3001 http://web-erp.svn.sourceforge.net/web-erp/?rev=3001&view=rev Author: daintree Date: 2009-11-15 06:30:58 +0000 (Sun, 15 Nov 2009) Log Message: ----------- New GLTrialBalance_csv.php script that produces a TB for import into OpenOffice scalc that has webERP authentication from GET parameters sent with the URL Modified Paths: -------------- trunk/DailySalesInquiry.php trunk/doc/Change.log.html trunk/includes/session.inc trunk/index.php Added Paths: ----------- trunk/GLTrialBalance_csv.php Modified: trunk/DailySalesInquiry.php =================================================================== --- trunk/DailySalesInquiry.php 2009-11-14 17:32:19 UTC (rev 3000) +++ trunk/DailySalesInquiry.php 2009-11-15 06:30:58 UTC (rev 3001) @@ -72,12 +72,13 @@ $StartDateSQL = date('Y-m-d', mktime(0,0,0, (int)$Date_Array[1],1,(int)$Date_Array[0])); $sql = "SELECT trandate, - SUM((price*(1-discountpercent) * -qty)) as salesvalue, + SUM(price*(1-discountpercent)* (-qty)) as salesvalue, SUM((standardcost * -qty)) as cost FROM stockmoves INNER JOIN custbranch ON stockmoves.debtorno=custbranch.debtorno AND stockmoves.branchcode=custbranch.branchcode WHERE (stockmoves.type=10 or stockmoves.type=11) + AND show_on_inv_crds =1 AND trandate>='" . $StartDateSQL . "' AND trandate<='" . $EndDateSQL . "'"; @@ -151,14 +152,14 @@ } if ($CumulativeTotalSales !=0){ - $AverageGPPercent = ($CumulativeTotalSales - $CumulativeTotalCost)/$CumulativeTotalSales; + $AverageGPPercent = ($CumulativeTotalSales - $CumulativeTotalCost)*100/$CumulativeTotalSales; $AverageDailySales = $CumulativeTotalSales/$BilledDays; } else { $AverageGPPercent = 0; $AverageDailySales = 0; } -echo '<td colspan=7>' . _('Total Sales for month') . ': ' . number_format($CumulativeTotalSales,0) . ' ' . _('GP%') . ': ' . number_format($AverageGPPercent,1) . ' ' . _('Avg Daily Sales') . ': ' . number_format($AverageDailySales,0) . '</td></tr>'; +echo '<td colspan=7>' . _('Total Sales for month') . ': ' . number_format($CumulativeTotalSales,0) . ' ' . _('GP%') . ': ' . number_format($AverageGPPercent,1) . '% ' . _('Avg Daily Sales') . ': ' . number_format($AverageDailySales,0) . '</td></tr>'; echo '</table>'; Added: trunk/GLTrialBalance_csv.php =================================================================== --- trunk/GLTrialBalance_csv.php (rev 0) +++ trunk/GLTrialBalance_csv.php 2009-11-15 06:30:58 UTC (rev 3001) @@ -0,0 +1,92 @@ +<?php + +/* $Id */ + +/*Through deviousness and cunning, this system allows trial balances for any date range that recalcuates the p & l balances +and shows the balance sheets as at the end of the period selected - so first off need to show the input of criteria screen +while the user is selecting the criteria the system is posting any unposted transactions */ + +/*Needs to have FromPeriod and ToPeriod sent with URL + * also need to work on authentication with username and password sent too*/ + +$PageSecurity = 8; +$AllowAnyone =true; +//$_POST['UserNameEntryField'] = $_GET['Identifier']; +//$_POST['Password'] = $_GET['IdentifierCheck']; +//Page must be called with GLTrialBalance_csv.php?CompanyName=XXXXX&FromPeriod=Y&ToPeriod=Z +$_POST['CompanyNameField'] = $_GET['CompanyName']; +//$_SERVER['PHP_SELF'] = dirname($_SERVER['PHP_SELF']) .'/GLTrialBalance_csv.php?ToPeriod=' . $_GET['ToPeriod'] . '&FromPeriod=' . $_GET['FromPeriod']; + +include ('includes/session.inc'); +include('includes/SQL_CommonFunctions.inc'); + +include ('includes/GLPostings.inc'); //do any outstanding posting + +$NumberOfMonths = $_GET['ToPeriod'] - $_GET['FromPeriod'] + 1; + +$RetainedEarningsAct = $_SESSION['CompanyRecord']['retainedearnings']; + +$SQL = 'SELECT accountgroups.groupname, + accountgroups.parentgroupname, + accountgroups.pandl, + chartdetails.accountcode , + chartmaster.accountname, + Sum(CASE WHEN chartdetails.period=' . $_GET['FromPeriod'] . ' THEN chartdetails.bfwd ELSE 0 END) AS firstprdbfwd, + Sum(CASE WHEN chartdetails.period=' . $_GET['FromPeriod'] . ' THEN chartdetails.bfwdbudget ELSE 0 END) AS firstprdbudgetbfwd, + Sum(CASE WHEN chartdetails.period=' . $_GET['ToPeriod'] . ' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lastprdcfwd, + Sum(CASE WHEN chartdetails.period=' . $_GET['ToPeriod'] . ' THEN chartdetails.actual ELSE 0 END) AS monthactual, + Sum(CASE WHEN chartdetails.period=' . $_GET['ToPeriod'] . ' THEN chartdetails.budget ELSE 0 END) AS monthbudget, + Sum(CASE WHEN chartdetails.period=' . $_GET['ToPeriod'] . ' THEN chartdetails.bfwdbudget + chartdetails.budget ELSE 0 END) AS lastprdbudgetcfwd + FROM chartmaster INNER JOIN accountgroups ON chartmaster.group_ = accountgroups.groupname + INNER JOIN chartdetails ON chartmaster.accountcode= chartdetails.accountcode + GROUP BY accountgroups.groupname, + accountgroups.parentgroupname, + accountgroups.pandl, + accountgroups.sequenceintb, + chartdetails.accountcode, + chartmaster.accountname + ORDER BY accountgroups.pandl desc, + accountgroups.sequenceintb, + accountgroups.groupname, + chartdetails.accountcode'; + +$AccountsResult = DB_query($SQL,$db); + +while ($myrow=DB_fetch_array($AccountsResult)) { + + if ($myrow['pandl']==1){ + $AccountPeriodActual = $myrow['lastprdcfwd'] - $myrow['firstprdbfwd']; + $AccountPeriodBudget = $myrow['lastprdbudgetcfwd'] - $myrow['firstprdbudgetbfwd']; + $PeriodProfitLoss += $AccountPeriodActual; + $PeriodBudgetProfitLoss += $AccountPeriodBudget; + $MonthProfitLoss += $myrow['monthactual']; + $MonthBudgetProfitLoss += $myrow['monthbudget']; + $BFwdProfitLoss += $myrow['firstprdbfwd']; + } else { /*PandL ==0 its a balance sheet account */ + if ($myrow['accountcode']==$RetainedEarningsAct){ + $AccountPeriodActual = $BFwdProfitLoss + $myrow['lastprdcfwd']; + $AccountPeriodBudget = $BFwdProfitLoss + $myrow['lastprdbudgetcfwd'] - $myrow['firstprdbudgetbfwd']; + } else { + $AccountPeriodActual = $myrow['lastprdcfwd']; + $AccountPeriodBudget = $myrow['firstprdbfwd'] + $myrow['lastprdbudgetcfwd'] - $myrow['firstprdbudgetbfwd']; + } + } + + $CSV_File .= $myrow['accountcode'] . ', ' . stripcomma($myrow['accountname']) . ', ' . $AccountPeriodActual . ', ' . $AccountPeriodBudget . "\n"; +} + +function stripcomma($str) { //because we're using comma as a delimiter + return str_replace(",", "", $str); +} +/* +$len = strlen($CSV_File); +header('Content-type: application/csv'); +header('Content-Length: ' . $len ); +header('Content-Disposition: inline; filename=GLTrialBalance.csv'); +header('Expires: 0'); +header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); +header('Pragma: public'); +*/ +echo $CSV_File; + +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-14 17:32:19 UTC (rev 3000) +++ trunk/doc/Change.log.html 2009-11-15 06:30:58 UTC (rev 3001) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>15/11/09 Phil: GLTrialBalance_csv.php Creates a csv of the trial balance with parameters for PeriodFrom and PeriodTo - also with webERP username and password set as part of the URL. This script allows a csv to be retrieved into an open-office spreadsheet directly with the loadComponentFromURL statement. Also modified session.inc - hope I've not broken anything else!! <p>14/11/09 Tim: StockLocStatus.php - Correct missing </a> tag. <p>12/11/09 Tim: Improve direct ordering code and make the EOQ the default quantity when ordered direct <p>12/11/09 Tim: PO_PDFPurchOrder.php - Correct syntax error Modified: trunk/includes/session.inc =================================================================== --- trunk/includes/session.inc 2009-11-14 17:32:19 UTC (rev 3000) +++ trunk/includes/session.inc 2009-11-15 06:30:58 UTC (rev 3001) @@ -155,8 +155,7 @@ $i++; } } - - + echo '<meta http-equiv="refresh" content="0" url="' . $_SERVER['PHP_SELF'] . '?' . SID . '">'; exit; } else { // Incorrect password Modified: trunk/index.php =================================================================== --- trunk/index.php 2009-11-14 17:32:19 UTC (rev 3000) +++ trunk/index.php 2009-11-15 06:30:58 UTC (rev 3001) @@ -2,7 +2,6 @@ /* $Revision: 1.89 $ */ - $PageSecurity = 1; include('includes/session.inc'); @@ -157,9 +156,13 @@ <?php echo "<a href='" . $rootpath . '/PDFOrdersInvoiced.php?' . SID . "'><LI>" . _('Orders Invoiced Reports') . '</LI></a>'; ?> </td> </tr> - <tr> <td class="menu_group_item"> + <?php echo "<a href='" . $rootpath . '/DailySalesInquiry.php?' . SID . "'><LI>" . _('Daily Sales Inquiry') . '</LI></a>'; ?> + </td> + </tr> + <tr> + <td class="menu_group_item"> <?php echo "<a href='" . $rootpath . '/PDFDeliveryDifferences.php?' . SID . "'><LI>" . _('Order Delivery Differences Report') . '</LI></a>'; ?> </td> </tr> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-15 13:17:22
|
Revision: 3006 http://web-erp.svn.sourceforge.net/web-erp/?rev=3006&view=rev Author: tim_schofield Date: 2009-11-15 13:17:14 +0000 (Sun, 15 Nov 2009) Log Message: ----------- Synchrinise css files so that all themes include all classes Modified Paths: -------------- trunk/css/default/default.css trunk/css/fresh/default.css trunk/css/gel/default.css trunk/css/jelly/default.css trunk/css/professional/default.css trunk/css/professional- rtl/default.css trunk/css/silverwolf/default.css trunk/doc/Change.log.html Modified: trunk/css/default/default.css =================================================================== --- trunk/css/default/default.css 2009-11-15 12:56:17 UTC (rev 3005) +++ trunk/css/default/default.css 2009-11-15 13:17:14 UTC (rev 3006) @@ -25,8 +25,11 @@ margin-right: 0px; padding: 0px; } -img {border:none;} +img { + border:none; +} + /*links before selection */ a { font-family: Verdana, Arial, Helvetica; @@ -47,9 +50,11 @@ background-color: #587BA6; margin: 0 auto; } + .dpTbl { border: solid navy 1px; } + div.centre { margin: 0 auto; text-align:center; @@ -61,6 +66,7 @@ font-size: 12px; text-align: left; } + .dpTD { border: 0; width:20px; @@ -68,6 +74,7 @@ text-align:right; cursor:pointer; } + .dpDayHighlight { border: 0; width:20px; @@ -75,6 +82,7 @@ text-align:right; cursor:pointer; } + .dpTDHover { border: 0; width:20px; @@ -82,9 +90,11 @@ text-align:right; cursor:pointer; } + td.number { text-align: right; } + .EvenTableRows { background-color: #CCCCCC; } @@ -123,35 +133,36 @@ border: 1px solid navy; } - -.EvenTableRows { - background-color: #CCCCCC; -} - -.OddTableRows { - background-color: #EEEEEE; -} - -th { - font-weight: normal; - background-color: #cccce5; - font-size: 12px; - color: #330000; - text-align: center; -} - input { font-family: Verdana, Arial, Helvetica; font-size: 12px; } + input.number{ text-align: right; } + +input:hover{ +} + select { font-family: Verdana, Arial, Helvetica; font-size: 12px; } +font.good { + font-weight: bold; + color: green; +} + +font.bad { + font-weight: bold; + color:red; +} + +font.header_title { +} + #topMenu { width: 100%; color: black; @@ -202,6 +213,53 @@ border: none; } +textarea{ + font-family: Verdana, Arial, Helvetica; + font-size: 12px; +} + +textarea:hover{ +} +/* Table type is used for UI tables type 1 */ +.table1 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +/* Table type is used for UI tables type 2 */ +.table2 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} + +input.address3 { + text-transform: uppercase; +} + +div.csv { + background:lightgray; + color: black; + border: 1px solid black; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 50%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + TEXT-ALIGN:center; +} + .callout_main { font-family: Verdana, Arial, Helvetica; background-color: white; @@ -237,6 +295,9 @@ top: 3px; */ } +#quick_menu{ +} + /*The main page heading left part before quick menu */ .quick_menu_left { font-family: Verdana, Arial, Helvetica; @@ -271,6 +332,29 @@ text-align: right; } +.quick_menu_tab a{ + color:#fff; + font-weight:bold; +} + +.quick_menu_left a{ + color:#fff; +} + +.quick_menu_tab a:hover{ + color:#ffc; + text-decoration:none; + font-weight:bold; +} + +.quick_menu_left a:hover{ + color:#ffc; + text-decoration:none; +} + +.quick_menu_tab:hover{ + color:#ffd; +} /*the Select Customer / Item / Supplier Menu tabs */ .system_menu_tabs { background-color: white; @@ -329,6 +413,17 @@ } +.main_menu_unselected:hover{ +} +.main_menu_selected:hover{ +} + +.main_menu_unselected a{ +} + +.main_menu_unselected a:hover{ +} + .main_menu_selected { background-color: white; border-top: 1px #AAAAAA solid; @@ -342,6 +437,16 @@ white-space: nowrap; } +.main_menu_selected a{ + color: #eee; + font-weight:bold; +} + +.main_menu_selected a:hover{ + color: #fff; + text-decoration: none; +} + span.main_menu_nolink { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -395,6 +500,9 @@ width: 25%; } +.menu_group_headers table{ + } + .menu_group_headers_text { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -418,6 +526,54 @@ padding-bottom: 2px; } +.page_title_text { + font-family: Verdana, Arial, Helvetica; + padding-top: 2px; + padding-bottom: 2px; + font-weight: bold; + font-size: 12px; + color: black; + TEXT-ALIGN:center; +} + +DIV.page_help_text { + background: lightgrey url(images/help.png) top left no-repeat; + BORDER: #a52a2a 1px solid; + padding-top:2px; + padding-bottom: 2px; + PADDING-LEFT: 10px; + Z-INDEX: 1; + width: 80%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:center; +} + +DIV.system_check { + BORDER: #a52a2a 1px solid; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 40%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + background: lightgray; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:left; +} + span.menu_group_nolink { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -439,13 +595,20 @@ bottom: -3px; } +a.footer { + font-family: Verdana, Arial, Helvetica; + color: black; + font-weight: normal; + font-size: 8px; +} + .footer { font-family: Verdana, Arial, Helvetica; color: #CCCCCC; font-weight: normal; font-size: 9px; - text-align: center; -} + t + .legal { font-family: Arial, Helvetica, sans-serif; font-size: 9px; @@ -509,6 +672,7 @@ font-style:italic; color:#555555; } + .label { font-weight:bold; font-style:normal; @@ -522,31 +686,10 @@ color: white; } -.page_title_text { - font-family: Verdana, Arial, Helvetica; - padding-top: 2px; - padding-bottom: 2px; - font-weight: bold; - font-size: 12px; - color: black; - TEXT-ALIGN:center; +.table_index { + background-color: #F1FFDD; } -DIV.page_help_text { - BORDER: #a52a2a 1px solid; - PADDING-LEFT: 3px; - Z-INDEX: 1; - width: 50%; - FLOAT: none; - VISIBILITY: visible; - MARGIN: 0 auto; - POSITION: static; - background-color: lightgray; - font-family: Verdana, Arial, Helvetica; - padding-top: 1px; - padding-bottom: 1px; - font-weight: normal; - font-size: 10px; - color: black; - TEXT-ALIGN:center; -} +li { + list-style-image: url(bullet.gif); +} \ No newline at end of file Modified: trunk/css/fresh/default.css =================================================================== --- trunk/css/fresh/default.css 2009-11-15 12:56:17 UTC (rev 3005) +++ trunk/css/fresh/default.css 2009-11-15 13:17:14 UTC (rev 3006) @@ -25,8 +25,11 @@ margin-right: 10px; padding: 0px; } -img {border:none;} +img { + border:none; +} + /*links before selection */ a { font-family: Verdana, Arial, Helvetica; @@ -46,6 +49,7 @@ background-color: #B4BB86; margin: 0 auto; } + .dpTbl { border: solid navy 1px; } @@ -61,6 +65,7 @@ font-size: 12px; text-align: left; } + .dpTD { border: 0; width:20px; @@ -68,6 +73,7 @@ text-align:right; cursor:pointer; } + .dpDayHighlight { border: 0; width:20px; @@ -75,6 +81,7 @@ text-align:right; cursor:pointer; } + .dpTDHover { border: 0; width:20px; @@ -82,9 +89,11 @@ text-align:right; cursor:pointer; } + td.number { text-align: right; } + .EvenTableRows { background-color: #CCCCCC; } @@ -125,34 +134,36 @@ border: 1px solid navy; } -.EvenTableRows { - background-color: #CCCCCC; -} - -.OddTableRows { - background-color: #EEEEEE; -} - -th { - font-weight: normal; - background-color: #cccce5; - font-size: 12px; - color: #330000; -} - input { font-family: Verdana, Arial, Helvetica; font-size: 12px; } + input.number{ text-align: right; } + +input:hover{ +} + select { font-family: Verdana, Arial, Helvetica; font-size: 12px; } +font.good { + font-weight: bold; + color: green; +} +font.bad { + font-weight: bold; + color:red; +} + +font.header_title { +} + #topMenu { width: 100%; color: black; @@ -203,6 +214,52 @@ border: none; } +textarea{ + font-family: Verdana, Arial, Helvetica; + font-size: 12px; +} + +textarea:hover{ +} +/* Table type is used for UI tables type 1 */ +.table1 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +/* Table type is used for UI tables type 2 */ +.table2 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +input.address3 { + text-transform: uppercase; +} + +div.csv { + background:lightgray; + color: black; + border: 1px solid black; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 50%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + TEXT-ALIGN:center; +} + .callout_main { font-family: Verdana, Arial, Helvetica; background-color: #ffffff; @@ -238,6 +295,9 @@ top: 3px; */ } +#quick_menu{ +} + /*The main page heading left part before quick menu */ .quick_menu_left { font-family: Verdana, Arial, Helvetica; @@ -270,6 +330,29 @@ text-align: right; } +.quick_menu_tab a{ + color:#fff; + font-weight:bold; +} + +.quick_menu_left a{ + color:#fff; +} + +.quick_menu_tab a:hover{ + color:#ffc; + text-decoration:none; + font-weight:bold; +} + +.quick_menu_left a:hover{ + color:#ffc; + text-decoration:none; +} + +.quick_menu_tab:hover{ + color:#ffd; +} /*the Select Customer / Item / Supplier Menu tabs */ .system_menu_tabs { background-color: #ffffff; @@ -317,6 +400,17 @@ white-space: nowrap; } +.main_menu_unselected:hover{ +} +.main_menu_selected:hover{ +} + +.main_menu_unselected a{ +} + +.main_menu_unselected a:hover{ +} + .main_menu_selected { background-color: #617C4F; border: 2px inset #41437D; @@ -324,6 +418,16 @@ white-space: nowrap; } +.main_menu_selected a{ + color: #eee; + font-weight:bold; +} + +.main_menu_selected a:hover{ + color: #fff; + text-decoration: none; +} + span.main_menu_nolink { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -370,6 +474,9 @@ width: 25%; } +.menu_group_headers table{ +} + .menu_group_headers_text { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -390,6 +497,54 @@ padding-bottom: 2px; } +.page_title_text { + font-family: Verdana, Arial, Helvetica; + padding-top: 2px; + padding-bottom: 2px; + font-weight: bold; + font-size: 12px; + color: black; + TEXT-ALIGN:center; +} + +DIV.page_help_text { + background: lightgrey url(images/help.png) top left no-repeat; + BORDER: #a52a2a 1px solid; + padding-top:2px; + padding-bottom: 2px; + PADDING-LEFT: 10px; + Z-INDEX: 1; + width: 80%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:center; +} + +DIV.system_check { + BORDER: #a52a2a 1px solid; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 40%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + background: lightgray; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:left; +} + span.menu_group_nolink { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -410,12 +565,14 @@ position: relative; bottom: -3px; } + a.footer { font-family: Verdana, Arial, Helvetica; color: black; font-weight: normal; font-size: 8px; } + .footer { font-family: Verdana, Arial, Helvetica; color: black; @@ -423,6 +580,7 @@ font-size: 8px; text-align: center; } + .legal { font-family: Arial, Helvetica, sans-serif; font-size: 9px; @@ -501,39 +659,11 @@ background-color: #234567; color: white; } + .table_index { background-color: #F1FFDD; } li { list-style-image: url(bullet.gif); -} - -.page_title_text { - font-family: Verdana, Arial, Helvetica; - padding-top: 2px; - padding-bottom: 2px; - font-weight: bold; - font-size: 12px; - color: black; - TEXT-ALIGN:center; -} - -DIV.page_help_text { - BORDER: #a52a2a 1px solid; - PADDING-LEFT: 3px; - Z-INDEX: 1; - width: 50%; - FLOAT: none; - VISIBILITY: visible; - MARGIN: 0 auto; - POSITION: static; - background-color: lightgray; - font-family: Verdana, Arial, Helvetica; - padding-top: 1px; - padding-bottom: 1px; - font-weight: normal; - font-size: 10px; - color: black; - TEXT-ALIGN:center; -} +} \ No newline at end of file Modified: trunk/css/gel/default.css =================================================================== --- trunk/css/gel/default.css 2009-11-15 12:56:17 UTC (rev 3005) +++ trunk/css/gel/default.css 2009-11-15 13:17:14 UTC (rev 3006) @@ -26,8 +26,11 @@ margin-right: 0px; padding: 0px; } -img {border:none;} +img { + border:none; +} + /*links before selection */ a { font-family: Verdana, Arial, Helvetica; @@ -43,17 +46,6 @@ text-decoration: none; } - -input{ - background: url(images/input.png) #eee; - color:#000; - border: 0px 0px 1px 1px #000 dashed; - font-family: Verdana, Arial, Helvetica; - font-size: 12px; -} -input.number{ - text-align: right; -} input:hover{ background: url(images/inputh.png) #eee; color:#000; @@ -71,15 +63,18 @@ color:#000; border: 1px 1px 1px 1px #000 solid; } + table { background-color: #eee; border: 0px 0px 2px 2px #222 solid; background: #eee; margin: 0 auto; } + .dpTbl { border: solid navy 1px; } + div.centre { margin: 0 auto; text-align:center; @@ -91,6 +86,7 @@ font-size: 12px; text-align: left; } + .dpTD { border: 0; width:20px; @@ -98,6 +94,7 @@ text-align:right; cursor:pointer; } + .dpDayHighlight { border: 0; width:20px; @@ -105,6 +102,7 @@ text-align:right; cursor:pointer; } + .dpTDHover { border: 0; width:20px; @@ -112,10 +110,27 @@ text-align:right; cursor:pointer; } + td.number { text-align: right; } +.EvenTableRows { + background-color: #CCCCCC; +} + +.OddTableRows { + background-color: #EEEEEE; +} + +th { + font-weight: normal; + background-color: #ccc; + font-size: 12px; + color: #330000; + text-align: center; +} + div.error { background-color:red; color: white; @@ -141,20 +156,19 @@ border: 1px solid white; } -.EvenTableRows { - background-color: #CCCCCC; +input{ + background: url(images/input.png) #eee; + color:#000; + border: 0px 0px 1px 1px #000 dashed; + font-family: Verdana, Arial, Helvetica; + font-size: 12px; } -.OddTableRows { - background-color: #EEEEEE; +input.number{ + text-align: right; } -th { - font-weight: normal; - background-color: #ccc; - font-size: 12px; - color: #330000; - text-align: center; +input:hover{ } select {background:#eee; @@ -163,7 +177,19 @@ font-size: 12px; } +font.good { + font-weight: bold; + color: green; +} +font.bad { + font-weight: bold; + color:red; +} + +font.header_title { +} + #topMenu { width: 100%; color: black; @@ -213,6 +239,55 @@ border: none; } +textarea{ + background: url(images/input.png) #eee; + color:#000; + border: 0px 0px 1px 1px #000 dashed; + font-family: Verdana, Arial, Helvetica; + font-size: 12px; +} + +textarea:hover{ +} +/* Table type is used for UI tables type 1 */ +.table1 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +/* Table type is used for UI tables type 2 */ +.table2 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +input.address3 { + text-transform: uppercase; +} + +div.csv { + background:lightgray; + color: black; + border: 1px solid black; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 50%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + TEXT-ALIGN:center; +} + .callout_main { font-family: Verdana, Arial, Helvetica; background-color: white; @@ -286,26 +361,28 @@ } .quick_menu_tab a{ -color:#fff; -font-weight:bold; + color:#fff; + font-weight:bold; } + .quick_menu_left a{ -color:#fff; + color:#fff; } - .quick_menu_tab a:hover{ -color:#ffc; -text-decoration:none; -font-weight:bold; + color:#ffc; + text-decoration:none; + font-weight:bold; } + .quick_menu_left a:hover{ -color:#ffc; -text-decoration:none; + color:#ffc; + text-decoration:none; } + .quick_menu_tab:hover{ -color:#ffd; -background: url(images/gelblueh.png) 0px -2px repeat-x; + color:#ffd; + background: url(images/gelblueh.png) 0px -2px repeat-x; } /*the Select Customer / Item / Supplier Menu tabs */ .system_menu_tabs { @@ -401,6 +478,12 @@ white-space: nowrap; } +.main_menu a { +} + +.main_menu a:hover { +} + .menu_group_img { background-color: #CCCCCC; text-align: center; @@ -416,7 +499,6 @@ .menu_group_area { border: none; - } .blank_area table { @@ -447,11 +529,58 @@ } .menu_group_item { - padding-top: 2px; padding-bottom: 2px; } +.page_title_text { + font-family: Verdana, Arial, Helvetica; + padding-top: 2px; + padding-bottom: 2px; + font-weight: bold; + font-size: 12px; + color: black; + TEXT-ALIGN:center; +} + +DIV.page_help_text { + background: lightgrey url(images/help.png) top left no-repeat; + BORDER: #a52a2a 1px solid; + padding-top:2px; + padding-bottom: 2px; + PADDING-LEFT: 10px; + Z-INDEX: 1; + width: 80%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:center; +} + +DIV.system_check { + BORDER: #a52a2a 1px solid; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 40%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + background: lightgray; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:left; +} + span.menu_group_nolink { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -475,6 +604,13 @@ } +a.footer { + font-family: Verdana, Arial, Helvetica; + color: black; + font-weight: normal; + font-size: 8px; +} + .footer { font-family: Verdana, Arial, Helvetica; color: black; @@ -482,6 +618,7 @@ font-size: 8px; text-align: center; } + .legal { font-family: Arial, Helvetica, sans-serif; font-size: 9px; @@ -558,3 +695,11 @@ background-color: #234567; color: white; } + +.table_index { + background-color: #F1FFDD; +} + +li { + list-style-image: url(bullet.gif); +} \ No newline at end of file Modified: trunk/css/jelly/default.css =================================================================== --- trunk/css/jelly/default.css 2009-11-15 12:56:17 UTC (rev 3005) +++ trunk/css/jelly/default.css 2009-11-15 13:17:14 UTC (rev 3006) @@ -26,7 +26,10 @@ margin-right: 0px; padding: 0px; } -img {border:none;} + +img { + border:none; +} /*links before selection */ a { font-family: Verdana, Arial, Helvetica; @@ -42,45 +45,7 @@ text-decoration: none; } -font.good { - font-weight: bold; - color: green; -} -font.bad { - font-weight: bold; - color:red; -} -/* In Jelly theme we don't want the page title text in the menu bar */ -font.header_title { - display:none -} -input{ - background: url(images/input.png) #eee; - color:#000; - border: 0px 0px 1px 1px #000 dashed; - font-family: Verdana, Arial, Helvetica; - font-size: 12px; -} -input.number{ - text-align: right; -} -input:hover{ - background: url(images/inputh.png) #eee; - color:#000; - border: 1px 1px 1px 1px #000 solid; -} -textarea{ - background: url(images/inputtxt.png) #eee; - color:#000; - border: 0px 0px 1px 1px #000 dashed; - font-family: Verdana, Arial, Helvetica; - font-size: 12px; - } -textarea:hover{ - background: url(images/inputhtxt.png) #eee; - color:#000; - border: 1px 1px 1px 1px #000 solid; -} + /* Table type is used for default tables*/ table { background: #eee; @@ -88,38 +53,23 @@ background: #eee; margin: 0 auto; } -/* Table type is used for UI tables type 1 */ -.table1 { - width:90%; - background: #eee; - border: 0px 0px 2px 2px #222 solid; - background: #eee; - margin: 0 auto; -} -/* Table type is used for UI tables type 2 */ -.table2 { - width:90%; - background: #eee; - border: 0px 0px 2px 2px #222 solid; - background: #eee; - margin: 0 auto; -} + .dpTbl { border: solid navy 1px; } + div.centre { margin: 0 auto; text-align:center; } + /*table detail items default format */ td { font-family: Verdana, Arial, Helvetica; font-size: 12px; text-align:left; } -input.address3 { - text-transform: uppercase; -} + .dpTD { border: 0; width:20px; @@ -127,6 +77,7 @@ text-align:right; cursor:pointer; } + .dpDayHighlight { border: 0; width:20px; @@ -134,6 +85,7 @@ text-align:right; cursor:pointer; } + .dpTDHover { border: 0; width:20px; @@ -141,9 +93,27 @@ text-align:right; cursor:pointer; } + td.number { text-align: right; } + +.EvenTableRows { + background: #CCCCCC; +} + +.OddTableRows { + background: #EEEEEE; +} + +th { + font-weight: normal; + background: #ccc; + font-size: 12px; + color: #330000; + text-align: center; +} + div.error { background:red; color: white; @@ -221,48 +191,44 @@ TEXT-ALIGN:center; } -div.csv { - background:lightgray; - color: black; - border: 1px solid black; - PADDING-LEFT: 3px; - Z-INDEX: 1; - width: 50%; - FLOAT: none; - VISIBILITY: visible; - MARGIN: 0 auto; - POSITION: static; - font-family: Verdana, Arial, Helvetica; - padding-top: 1px; - padding-bottom: 1px; - font-weight: normal; - font-size: 10px; - TEXT-ALIGN:center; +input{ + background: url(images/input.png) #eee; + color:#000; + border: 0px 0px 1px 1px #000 dashed; + font-family: Verdana, Arial, Helvetica; + font-size: 12px; } -.EvenTableRows { - background: #CCCCCC; +input.number{ + text-align: right; } -.OddTableRows { - background: #EEEEEE; +input:hover{ + background: url(images/inputh.png) #eee; + color:#000; + border: 1px 1px 1px 1px #000 solid; } -th { - font-weight: normal; - background: #ccc; - font-size: 12px; - color: #330000; - text-align: center; -} - select {background:#eee; color:#111; font-family: Verdana, Arial, Helvetica; font-size: 12px; } +font.good { + font-weight: bold; + color: green; +} +font.bad { + font-weight: bold; + color:red; +} +/* In Jelly theme we don't want the page title text in the menu bar */ +font.header_title { + display:none +} + #topMenu { width: 100%; color: black; @@ -312,6 +278,58 @@ border: none; } +textarea{ + background: url(images/inputtxt.png) #eee; + color:#000; + border: 0px 0px 1px 1px #000 dashed; + font-family: Verdana, Arial, Helvetica; + font-size: 12px; + } +textarea:hover{ + background: url(images/inputhtxt.png) #eee; + color:#000; + border: 1px 1px 1px 1px #000 solid; +} +/* Table type is used for UI tables type 1 */ +.table1 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +/* Table type is used for UI tables type 2 */ +.table2 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +input.address3 { + text-transform: uppercase; +} + +div.csv { + background:lightgray; + color: black; + border: 1px solid black; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 50%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + TEXT-ALIGN:center; +} + + .callout_main { font-family: Verdana, Arial, Helvetica; background: white; @@ -387,26 +405,28 @@ } .quick_menu_tab a{ -color:#fff; -font-weight:bold; + color:#fff; + font-weight:bold; } + .quick_menu_left a{ -color:#fff; + color:#fff; } - .quick_menu_tab a:hover{ -color:#ffc; -text-decoration:none; -font-weight:bold; + color:#ffc; + text-decoration:none; + font-weight:bold; } + .quick_menu_left a:hover{ -color:#ffc; -text-decoration:none; + color:#ffc; + text-decoration:none; } + .quick_menu_tab:hover{ -color:#ffd; -background: url(images/gelblueh.png) 0px -2px repeat-x; + color:#ffd; + background: url(images/gelblueh.png) 0px -2px repeat-x; } /*the Select Customer / Item / Supplier Menu tabs */ .system_menu_tabs { @@ -502,6 +522,12 @@ white-space: nowrap; } +.main_menu a { +} + +.main_menu a:hover { +} + .menu_group_img { background: #CCCCCC; text-align: center; @@ -517,7 +543,6 @@ .menu_group_area { border: none; - } .blank_area table { @@ -548,7 +573,6 @@ } .menu_group_item { - padding-top: 2px; padding-bottom: 2px; } @@ -623,6 +647,13 @@ position: relative; } +a.footer { + font-family: Verdana, Arial, Helvetica; + color: black; + font-weight: normal; + font-size: 8px; +} + .footer { font-family: Verdana, Arial, Helvetica; color: black; @@ -630,6 +661,7 @@ font-size: 8px; text-align: center; } + .legal { font-family: Arial, Helvetica, sans-serif; font-size: 9px; @@ -706,3 +738,11 @@ background: #234567; color: white; } + +.table_index { + background-color: #F1FFDD; +} + +li { + list-style-image: url(bullet.gif); +} \ No newline at end of file Modified: trunk/css/professional/default.css =================================================================== --- trunk/css/professional/default.css 2009-11-15 12:56:17 UTC (rev 3005) +++ trunk/css/professional/default.css 2009-11-15 13:17:14 UTC (rev 3006) @@ -25,8 +25,11 @@ margin-right: 10px; padding: 0px; } -img {border:none;} +img { + border:none; +} + /*links before selection */ a { font-family: Verdana, Arial, Helvetica; @@ -46,9 +49,11 @@ background-color: #EEEEFF; margin: 0 auto; } + .dpTbl { border: solid navy 1px; } + div.centre { margin: 0 auto; text-align:center; @@ -60,6 +65,7 @@ font-size: 12px; text-align: left; } + .dpTD { border: 0; width:20px; @@ -67,6 +73,7 @@ text-align:right; cursor:pointer; } + .dpDayHighlight { border: 0; width:20px; @@ -74,6 +81,7 @@ text-align:right; cursor:pointer; } + .dpTDHover { border: 0; width:20px; @@ -81,9 +89,11 @@ text-align:right; cursor:pointer; } + td.number { text-align: right; } + .EvenTableRows { background-color: #CCCCCC; } @@ -128,15 +138,32 @@ font-family: Verdana, Arial, Helvetica; font-size: 12px; } + input.number{ text-align: right; } + +input:hover{ +} + select { font-family: Verdana, Arial, Helvetica; font-size: 12px; } +font.good { + font-weight: bold; + color: green; +} +font.bad { + font-weight: bold; + color:red; +} + +font.header_title { +} + #topMenu { width: 100%; color: black; @@ -187,6 +214,52 @@ border: none; } +textarea{ + font-family: Tahoma, Verdana, Arial, Helvetica; + font-size: 12px; +} + +textarea:hover{ +} +/* Table type is used for UI tables type 1 */ +.table1 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +/* Table type is used for UI tables type 2 */ +.table2 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +input.address3 { + text-transform: uppercase; +} + +div.csv { + background:lightgray; + color: black; + border: 1px solid black; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 50%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + TEXT-ALIGN:center; +} + .callout_main { font-family: Verdana, Arial, Helvetica; background-color: white; @@ -222,6 +295,9 @@ top: 3px; */ } +#quick_menu{ +} + /*The main page heading left part before quick menu */ .quick_menu_left { font-family: Verdana, Arial, Helvetica; @@ -255,6 +331,29 @@ text-align: right; } +.quick_menu_tab a{ + color:#fff; + font-weight:bold; +} + +.quick_menu_left a{ + color:#fff; +} + +.quick_menu_tab a:hover{ + color:#ffc; + text-decoration:none; + font-weight:bold; +} + +.quick_menu_left a:hover{ + color:#ffc; + text-decoration:none; +} + +.quick_menu_tab:hover{ + color:#ffd; +} /*the Select Customer / Item / Supplier Menu tabs */ .system_menu_tabs { background-color: white; @@ -303,6 +402,17 @@ white-space: nowrap; } +.main_menu_unselected:hover{ +} +.main_menu_selected:hover{ +} + +.main_menu_unselected a{ +} + +.main_menu_unselected a:hover{ +} + .main_menu_selected { background-color: #CCCCCC; border: 2px inset white; @@ -311,6 +421,16 @@ white-space: nowrap; } +.main_menu_selected a{ + color: #eee; + font-weight:bold; +} + +.main_menu_selected a:hover{ + color: #fff; + text-decoration: none; +} + span.main_menu_nolink { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -356,6 +476,9 @@ width: 25%; } +.menu_group_headers table{ +} + .menu_group_headers_text { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -376,6 +499,54 @@ padding-bottom: 2px; } +.page_title_text { + font-family: Verdana, Arial, Helvetica; + padding-top: 2px; + padding-bottom: 2px; + font-weight: bold; + font-size: 12px; + color: black; + TEXT-ALIGN:center; +} + +DIV.page_help_text { + background: lightgrey url(images/help.png) top left no-repeat; + BORDER: #a52a2a 1px solid; + padding-top:2px; + padding-bottom: 2px; + PADDING-LEFT: 10px; + Z-INDEX: 1; + width: 80%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:center; +} + +DIV.system_check { + BORDER: #a52a2a 1px solid; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 40%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + background: lightgray; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:left; +} + span.menu_group_nolink { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -397,6 +568,13 @@ bottom: -3px; } +a.footer { + font-family: Verdana, Arial, Helvetica; + color: black; + font-weight: normal; + font-size: 8px; +} + .footer { font-family: Verdana, Arial, Helvetica; color: black; @@ -404,6 +582,7 @@ font-size: 8px; text-align: center; } + .legal { font-family: Arial, Helvetica, sans-serif; font-size: 9px; @@ -477,37 +656,15 @@ background-color:#cccccc; } - .OsRow { background-color: #234567; color: white; } -.page_title_text { - font-family: Verdana, Arial, Helvetica; - padding-top: 2px; - padding-bottom: 2px; - font-weight: bold; - font-size: 12px; - color: black; - TEXT-ALIGN:center; +.table_index { + background-color: #F1FFDD; } -DIV.page_help_text { - BORDER: #a52a2a 1px solid; - PADDING-LEFT: 3px; - Z-INDEX: 1; - width: 50%; - FLOAT: none; - VISIBILITY: visible; - MARGIN: 0 auto; - POSITION: static; - background-color: lightgray; - font-family: Verdana, Arial, Helvetica; - padding-top: 1px; - padding-bottom: 1px; - font-weight: normal; - font-size: 10px; - color: black; - TEXT-ALIGN:center; -} +li { + list-style-image: url(bullet.gif); +} \ No newline at end of file Modified: trunk/css/professional- rtl/default.css =================================================================== --- trunk/css/professional- rtl/default.css 2009-11-15 12:56:17 UTC (rev 3005) +++ trunk/css/professional- rtl/default.css 2009-11-15 13:17:14 UTC (rev 3006) @@ -27,8 +27,11 @@ padding: 0px; direction: rtl; } -img {border:none;} +img { + border:none; +} + /*links before selection */ a { font-family: Tahoma, Verdana, Arial, Helvetica; @@ -48,9 +51,11 @@ background-color: #EEEEFF; margin: 0 auto; } + .dpTbl { border: solid navy 1px; } + div.centre { margin: 0 auto; text-align:center; @@ -62,6 +67,7 @@ font-size: 12px; text-align: left; } + .dpTD { border: 0; width:20px; @@ -69,6 +75,7 @@ text-align:right; cursor:pointer; } + .dpDayHighlight { border: 0; width:20px; @@ -76,6 +83,7 @@ text-align:right; cursor:pointer; } + .dpTDHover { border: 0; width:20px; @@ -83,22 +91,81 @@ text-align:right; cursor:pointer; } + td.number { text-align: right; } + +.EvenTableRows { + background: #CCCCCC; +} + +.OddTableRows { + background: #EEEEEE; +} + +th { + font-weight: normal; + font-size: 12px; + background-color: #cccce5; + color: #330000; + text-align: center; +} + +div.error { + background-color:#fddbdb; + color: red; + border: 1px solid red; +} + +div.warn { + background-color:#f5dbfd; + color: maroon; + border: 1px solid maroon; +} + +div.success { + background-color:#b9ecb4; + color: darkgreen; + border: 1px solid darkgreen; +} + +div.info { + background-color:#c7ccf6; + color: navy; + border: 1px solid navy; +} + input { font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 12px; } + input.number{ text-align: right; } + +input:hover{ +} + select { font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 12px; } +font.good { + font-weight: bold; + color: green; +} +font.bad { + font-weight: bold; + color:red; +} + +font.header_title { +} + #topMenu { width: 100%; color: black; @@ -149,6 +216,52 @@ border: none; } +textarea{ + font-family: Tahoma, Verdana, Arial, Helvetica; + font-size: 12px; +} + +textarea:hover{ +} +/* Table type is used for UI tables type 1 */ +.table1 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +/* Table type is used for UI tables type 2 */ +.table2 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +input.address3 { + text-transform: uppercase; +} + +div.csv { + background:lightgray; + color: black; + border: 1px solid black; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 50%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + TEXT-ALIGN:center; +} + .callout_main { font-family: Tahoma, Verdana, Arial, Helvetica; background-color: white; @@ -184,6 +297,9 @@ top: 3px; */ } +#quick_menu{ +} + /*The main page heading left part before quick menu */ .quick_menu_left { font-family: Tahoma, Verdana, Arial, Helvetica; @@ -217,6 +333,30 @@ text-align: right; } +.quick_menu_tab a{ + color:#fff; + font-weight:bold; +} + +.quick_menu_left a{ + color:#fff; +} + +.quick_menu_tab a:hover{ + color:#ffc; + text-decoration:none; + font-weight:bold; +} + +.quick_menu_left a:hover{ + color:#ffc; + text-decoration:none; +} + +.quick_menu_tab:hover{ + color:#ffd; +} + /*the Select Customer / Item / Supplier Menu tabs */ .system_menu_tabs { background-color: white; @@ -265,6 +405,17 @@ white-space: nowrap; } +.main_menu_unselected:hover{ +} +.main_menu_selected:hover{ +} + +.main_menu_unselected a{ +} + +.main_menu_unselected a:hover{ +} + .main_menu_selected { background-color: #CCCCCC; border: 2px inset white; @@ -273,6 +424,16 @@ white-space: nowrap; } +.main_menu_selected a{ + color: #eee; + font-weight:bold; +} + +.main_menu_selected a:hover{ + color: #fff; + text-decoration: none; +} + span.main_menu_nolink { font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 12px; @@ -318,6 +479,9 @@ width: 25%; } +.menu_group_headers table{ +} + .menu_group_headers_text { font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 12px; @@ -338,6 +502,54 @@ padding-bottom: 2px; } +.page_title_text { + font-family: Verdana, Arial, Helvetica; + padding-top: 2px; + padding-bottom: 2px; + font-weight: bold; + font-size: 12px; + color: black; + TEXT-ALIGN:center; +} + +DIV.page_help_text { + background: lightgrey url(images/help.png) top left no-repeat; + BORDER: #a52a2a 1px solid; + padding-top:2px; + padding-bottom: 2px; + PADDING-LEFT: 10px; + Z-INDEX: 1; + width: 80%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:center; +} + +DIV.system_check { + BORDER: #a52a2a 1px solid; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 40%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + background: lightgray; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:left; +} + span.menu_group_nolink { font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 12px; @@ -359,6 +571,13 @@ bottom: -3px; } +a.footer { + font-family: Verdana, Arial, Helvetica; + color: black; + font-weight: normal; + font-size: 8px; +} + .footer { font-family: Tahoma, Verdana, Arial, Helvetica; color: black; @@ -366,6 +585,7 @@ font-size: 8px; text-align: center; } + .legal { font-family: Arial, Helvetica, sans-serif; font-size: 9px; @@ -398,7 +618,6 @@ font-size: medium; } - input.big { width: 100px; } @@ -407,6 +626,18 @@ width: 50px; } +input.inputerror { + background-color: #fddbdb; +} + +textarea.texterror { + background-color: #fddbdb; +} + +select.selecterror { + background-color: #fddbdb; +} + .tableheader { font-weight: normal; background-color: #cccce5; @@ -427,8 +658,15 @@ background-color:#cccccc; } - .OsRow { background-color: #234567; color: white; } + +.table_index { + background-color: #F1FFDD; +} + +li { + list-style-image: url(bullet.gif); +} \ No newline at end of file Modified: trunk/css/silverwolf/default.css =================================================================== --- trunk/css/silverwolf/default.css 2009-11-15 12:56:17 UTC (rev 3005) +++ trunk/css/silverwolf/default.css 2009-11-15 13:17:14 UTC (rev 3006) @@ -94,6 +94,22 @@ text-align: right; } +.EvenTableRows { + background-color: #ccc; +} + +.OddTableRows { + background-color: #eee; +} + +th { + font-weight: normal; + background-color: #cccce5; + font-size: 12px; + color: #300; + text-align: center; +} + div.error { background-color:#fddbdb; color: red; @@ -118,22 +134,6 @@ border: 1px solid navy; } -.EvenTableRows { - background-color: #ccc; -} - -.OddTableRows { - background-color: #eee; -} - -th { - font-weight: normal; - background-color: #cccce5; - font-size: 12px; - color: #300; - text-align: center; -} - input { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -143,11 +143,27 @@ text-align: right; } +input:hover{ +} + select { font-family: Verdana, Arial, Helvetica; font-size: 12px; } +font.good { + font-weight: bold; + color: green; +} + +font.bad { + font-weight: bold; + color:red; +} + +font.header_title { +} + #topMenu { width: 100%; color: black; @@ -197,6 +213,52 @@ border: none; } +textarea{ + font-family: Verdana, Arial, Helvetica; + font-size: 12px; +} + +textarea:hover{ +} +/* Table type is used for UI tables type 1 */ +.table1 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +/* Table type is used for UI tables type 2 */ +.table2 { + width:90%; + background: #eee; + border: 0px 0px 2px 2px #222 solid; + background: #eee; + margin: 0 auto; +} +input.address3 { + text-transform: uppercase; +} + +div.csv { + background:lightgray; + color: black; + border: 1px solid black; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 50%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + TEXT-ALIGN:center; +} + .callout_main { font-family: Verdana, Arial, Helvetica; background-color: white; @@ -269,6 +331,30 @@ text-align: right; } +.quick_menu_tab a{ + color:#000; + font-weight:bold; +} + +.quick_menu_left a{ + color:#fff; +} + +.quick_menu_tab a:hover{ + color:#ffc; + text-decoration:none; + font-weight:bold; +} + +.quick_menu_left a:hover{ + color:#ffc; + text-decoration:none; +} + +.quick_menu_tab:hover{ + color:#ffd; +} + /*the Select Customer / Item / Supplier Menu tabs */ .system_menu_tabs { background-color: white; @@ -318,6 +404,17 @@ height: 16pt; } +.main_menu_unselected:hover{ +} +.main_menu_selected:hover{ +} + +.main_menu_unselected a{ +} + +.main_menu_unselected a:hover{ +} + .main_menu_unselected:hover { background: #aaa url(images/menu_bg_dblue.png) 0px -10px repeat-x; } @@ -357,6 +454,12 @@ white-space: nowrap; } +.main_menu a { +} + +.main_menu a:hover { +} + .menu_group_img { background-color: #ccc; text-align: center; @@ -402,11 +505,58 @@ } .menu_group_item { - padding-top: 2px; padding-bottom: 2px; } +.page_title_text { + font-family: Verdana, Arial, Helvetica; + padding-top: 2px; + padding-bottom: 2px; + font-weight: bold; + font-size: 12px; + color: black; + TEXT-ALIGN:center; +} + +DIV.page_help_text { + background: lightgrey url(images/help.png) top left no-repeat; + BORDER: #a52a2a 1px solid; + padding-top:2px; + padding-bottom: 2px; + PADDING-LEFT: 10px; + Z-INDEX: 1; + width: 80%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + font-family: Verdana, Arial, Helvetica; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:center; +} + +DIV.system_check { + BORDER: #a52a2a 1px solid; + PADDING-LEFT: 3px; + Z-INDEX: 1; + width: 40%; + FLOAT: none; + VISIBILITY: visible; + MARGIN: 0 auto; + POSITION: static; + background: lightgray; + font-family: Verdana, Arial, Helvetica; + padding-top: 1px; + padding-bottom: 1px; + font-weight: normal; + font-size: 10px; + color: black; + TEXT-ALIGN:left; +} + span.menu_group_nolink { font-family: Verdana, Arial, Helvetica; font-size: 12px; @@ -431,6 +581,13 @@ bottom: -3px; } +a.footer { + font-family: Verdana, Arial, Helvetica; + color: black; + font-weight: normal; + font-size: 8px; +} + .footer { font-family: Verdana, Arial, Helvetica; color: black; @@ -438,6 +595,7 @@ font-size: 8px; text-align: center; } + .legal { font-family: Arial, Helvetica, sans-serif; font-size: 9px; @@ -515,31 +673,10 @@ color: white; } -.page_title_text { - font-family: Verdana, Arial, Helvetica; - padding-top: 2px; - padding-bottom: 2px; - font-weight: bold; - font-size: 12px; - color: black; - text-align:center; +.table_index { + background-color: #F1FFDD; } -div.page_help_text { - border: #a52a2a 1px solid; - padding-left: 3px; - z-index: 1; - width: 50%; - float: none; - visibility: visible; - margin: 0 auto; - position: static; - background-color: lightgray; - font-family: Verdana, Arial, Helvetica; - padding-top: 1px; - padding-bottom: 1px; - font-weight: normal; - font-size: 10px; - color: black; - text-align:center; -} +li { + list-style-image: url(bullet.gif); +} \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-15 12:56:17 UTC (rev 3005) +++ trunk/doc/Change.log.html 2009-11-15 13:17:14 UTC (rev 3006) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p> 15/11/09 Tim: default.css - Synchrinise css files so that all themes include all classes <p>15/11/09 Phil: GLTrialBalance_csv.php Creates a csv of the trial balance with parameters for PeriodFrom and PeriodTo - also with webERP username and password set as part of the URL. This script allows a csv to be retrieved into an open-office spreadsheet directly with the loadComponentFromURL statement. Also modified session.inc - hope I've not broken anything else!! <p>14/11/09 Tim: StockLocStatus.php - Correct missing </a> tag. <p>12/11/09 Tim: Improve direct ordering code and make the EOQ the default quantity when ordered direct This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-18 10:18:11
|
Revision: 3042 http://web-erp.svn.sourceforge.net/web-erp/?rev=3042&view=rev Author: tim_schofield Date: 2009-11-18 10:17:55 +0000 (Wed, 18 Nov 2009) Log Message: ----------- Provide option to print a customer receipt Modified Paths: -------------- trunk/CustomerReceipt.php trunk/doc/Change.log.html Added Paths: ----------- trunk/PDFReceipt.php Modified: trunk/CustomerReceipt.php =================================================================== --- trunk/CustomerReceipt.php 2009-11-18 07:47:54 UTC (rev 3041) +++ trunk/CustomerReceipt.php 2009-11-18 10:17:55 UTC (rev 3042) @@ -210,9 +210,38 @@ $BatchReceiptsTotal = 0; //in functional currency $BatchDiscount = 0; //in functional currency $BatchDebtorTotal = 0; //in functional currency + $k=0; //Table row counter for row styles + $CustomerReceiptCounter=1; //Count lines of customer receipts in this batch + echo '<br /><p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/money_add.png" title="' . _('Allocate') . '" alt="">' . ' ' . _('Summary of Receipt Batch').'</p><br />'; + + echo '<table><tr><th>'._('Batch Number').'</th> + <th>'._('Date Banked').'</th> + <th>'._('Customer Name').'</th + <th>'._('GL Code').'</th + <th>'._('Amount of Receipt').'</th></tr>'; + foreach ($_SESSION['ReceiptBatch']->Items as $ReceiptItem) { + + if ($k==1){ + echo '<tr class="OddTableRows">'; + $k=0; + } else { + echo '<tr class="EvenTableRows">'; + $k=1; + } + echo '<td>'.$_SESSION['ReceiptBatch']->BatchNo.'</td> + <td>'.$_SESSION['ReceiptBatch']->DateBanked.'</td> + <td>'.$ReceiptItem->CustomerName.'</td> + <td>'.$ReceiptItem->GLCode.'</td> + <td class=number>'.number_format($ReceiptItem->Amount/$_SESSION['ReceiptBatch']->ExRate/$_SESSION['ReceiptBatch']->FunctionalExRate,2) .'</td>'; + + if ($ReceiptItem->GLCode ==''){ + echo '<td><a target="_blank" href="' . $rootpath . '/PDFReceipt.php?BatchNumber=' . $_SESSION['ReceiptBatch']->BatchNo. '&ReceiptNumber='.$CustomerReceiptCounter.'">'._('Print a Customer Receipt').'</a></td></tr>'; + $CustomerReceiptCounter += 1; + } + if ($ReceiptItem->GLCode !=''){ if ($_SESSION['CompanyRecord']['gllink_debtors']==1){ /* then enter a GLTrans record */ $SQL = 'INSERT INTO gltrans (type, @@ -337,12 +366,12 @@ '', '" . FormatDateForSQL($_SESSION['ReceiptBatch']->DateBanked) . "', " . $PeriodNo . ", - '" . $_SESSION['ReceiptBatch']->ReceiptType . ' ' . $ReceiptItem->Narrative . "', + '" . $_SESSION['ReceiptBatch']->ReceiptType . ' ' . $ReceiptItem->PayeeBankDetail . "', '', " . ($_SESSION['ReceiptBatch']->ExRate/$_SESSION['ReceiptBatch']->FunctionalExRate) . ", " . -$ReceiptItem->Amount . ", " . -$ReceiptItem->Discount . ", - '" . $ReceiptItem->PayeeBankDetail . "' + '" . $ReceiptItem->Narrative. "' )"; $DbgMsg = _('The SQL that failed to insert the customer receipt transaction was'); $ErrMsg = _('Cannot insert a receipt transaction against the customer because') ; @@ -361,6 +390,7 @@ $BatchReceiptsTotal += ($ReceiptItem->Amount/$_SESSION['ReceiptBatch']->ExRate/$_SESSION['ReceiptBatch']->FunctionalExRate); } /*end foreach $ReceiptItem */ + echo '</table>'; if ($_SESSION['CompanyRecord']['gllink_debtors']==1){ /* then enter GLTrans records for discount, bank and debtors */ @@ -496,7 +526,7 @@ $SQL = "SELECT debtorsmaster.debtorno, debtorsmaster.name FROM debtorsmaster - WHERE debtorsmaster.name " . LIKE . " '$SearchString' + WHERE debtorsmaster.name LIKE '". $SearchString."' AND debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch']->Currency . "'"; } elseif (strlen($_POST['CustCode'])>0){ @@ -513,6 +543,7 @@ WHERE debtortrans.transno " . LIKE . " '%" . $_POST['CustInvNo'] . "%' AND debtorsmaster.currcode= '" . $_SESSION['ReceiptBatch']->Currency . "'"; } + $CustomerSearchResult = DB_query($SQL,$db,'','',false,false); if (DB_error_no($db) !=0) { prnMsg(_('The searched customer records requested cannot be retrieved because') . ' - ' . DB_error_msg($db),'error'); @@ -941,8 +972,10 @@ echo '<tr><td>' . _('Payee Bank Details') . ':</td> <td><input tabindex=12 type="text" name="PayeeBankDetail" maxlength=22 size=20 value="' . $_POST['PayeeBankDetail'] . '"></td></tr>'; - echo '<tr><td>' . _('Narrative') . ':</td> - <td><input tabindex=13 type="text" name="Narrative" maxlength=30 size=32 value="' . $_POST['Narrative'] . '"></td></tr>'; +// echo '<tr><td>' . _('Narrative') . ':</td> +// <td><input tabindex=13 type="text" name="Narrative" maxlength=30 size=32 value="' . $_POST['Narrative'] . '"></td></tr>'; + echo '<td>' . _('Narrative') . ':</td>'; + echo '<td><textarea name="Narrative" cols=40 rows=1></textarea></td>'; echo '</table>'; echo '<div class="centre"><input tabindex=14 type="submit" name="Process" value="' . _('Accept') . '">'; echo '<input tabindex=14 type="submit" name="Cancel" value="' . _('Cancel') . '"></div>'; Added: trunk/PDFReceipt.php =================================================================== --- trunk/PDFReceipt.php (rev 0) +++ trunk/PDFReceipt.php 2009-11-18 10:17:55 UTC (rev 3042) @@ -0,0 +1,121 @@ +<?php +/* $Id $ */ + +$PageSecurity = 2; +include('includes/session.inc'); + +include('includes/PDFStarter.php'); + +$FontSize=10; +$pdf->addinfo('Title', _('Sales Receipt') ); + +$PageNumber=1; +$line_height=12; +if ($PageNumber>1){ + $pdf->newPage(); +} + +$FontSize=10; +$YPos= $Page_Height-$Top_Margin; +$XPos=0; +$pdf->addJpegFromFile($_SESSION['LogoFile'] ,$XPos+20,$YPos-50,0,60); + + +$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*6),300,$FontSize,$_SESSION['CompanyRecord']['coyname']); +$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*7),300,$FontSize,$_SESSION['CompanyRecord']['regoffice1']); +$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*8),300,$FontSize,$_SESSION['CompanyRecord']['regoffice2']); +$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*9),300,$FontSize,$_SESSION['CompanyRecord']['regoffice3']); +$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*10),300,$FontSize,$_SESSION['CompanyRecord']['regoffice4']); +$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*11),300,$FontSize,$_SESSION['CompanyRecord']['regoffice5']); +$LeftOvers = $pdf->addTextWrap(50,$YPos-($line_height*12),300,$FontSize,$_SESSION['CompanyRecord']['regoffice6']); +$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-180,$YPos-($line_height*3),550,$FontSize, _('Customer Receipt Number ').' : ' . $_GET['BatchNumber'] .'/'.$_GET['ReceiptNumber'] ); +$LeftOvers = $pdf->addTextWrap($Page_Width-$Right_Margin-180,$YPos-($line_height*4.5),140,$FontSize, _('Printed').': ' . Date($_SESSION['DefaultDateFormat']) . ' '. _('Page'). ' ' . $PageNumber); + +$YPos -= 150; + +$YPos -=$line_height; +//Note, this is ok for multilang as this is the value of a Select, text in option is different + +$YPos -=(2*$line_height); + +/*Draw a rectangle to put the headings in */ + +$pdf->line($Left_Margin, $YPos+$line_height,$Page_Width-$Right_Margin, $YPos+$line_height); + +$FontSize=10; +$YPos -= (1.5 * $line_height); + +$PageNumber++; + +$sql='SELECT MIN(id) as start FROM debtortrans WHERE type=12 AND transno='.$_GET['BatchNumber']; +$result=DB_query($sql, $db); +$myrow=DB_fetch_array($result); +$StartReceiptNumber=$myrow['start']; + +$sql='SELECT debtorno, + ovamount, + invtext + FROM debtortrans + WHERE type=12 + AND transno='.$_GET['BatchNumber'].' + AND id='.($StartReceiptNumber-1+$_GET['ReceiptNumber']); +$result=DB_query($sql, $db); +$myrow=DB_fetch_array($result); +$DebtorNo=$myrow['debtorno']; +$Amount=$myrow['ovamount']; +$Narrative=$myrow['invtext']; + +$sql='SELECT currency, + decimalplaces + FROM currencies + WHERE currabrev=(SELECT currcode + FROM banktrans + WHERE type=12 + AND transno='.$_GET['BatchNumber'].')'; +$result=DB_query($sql, $db); +$myrow=DB_fetch_array($result); +$Currency=$myrow['currency']; +$DecimalPlaces=$myrow['decimalplaces']; + +$sql='SELECT name, + address1, + address2, + address3, + address4, + address5, + address6 + FROM debtorsmaster + WHERE debtorno="'.$DebtorNo.'"'; + +$result=DB_query($sql, $db); +$myrow=DB_fetch_array($result); + +$LeftOvers = $pdf->addTextWrap(50,$YPos,300,$FontSize,_('Received From').' : '); + +$LeftOvers = $pdf->addTextWrap(150,$YPos,300,$FontSize, htmlspecialchars_decode($myrow['name'])); +$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*1),300,$FontSize, htmlspecialchars_decode($myrow['address1'])); +$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*2),300,$FontSize, htmlspecialchars_decode($myrow['address2'])); +$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*3),300,$FontSize, htmlspecialchars_decode($myrow['address3'])); +$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*4),300,$FontSize, htmlspecialchars_decode($myrow['address4'])); +$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*5),300,$FontSize, htmlspecialchars_decode($myrow['address5'])); +$LeftOvers = $pdf->addTextWrap(150,$YPos-($line_height*6),300,$FontSize, htmlspecialchars_decode($myrow['address6'])); + +$YPos=$YPos-($line_height*8); + +$LeftOvers = $pdf->addTextWrap(50,$YPos,300,$FontSize,_('The Sum Of').' : '); +$LeftOvers = $pdf->addTextWrap(150,$YPos,300,$FontSize,number_format(-$Amount,$DecimalPlaces).' '.$Currency); + +$YPos=$YPos-($line_height*2); + +$LeftOvers = $pdf->addTextWrap(50,$YPos,500,$FontSize,_('Details').' : '.$Narrative); + +$YPos=$YPos-($line_height*8); + +$LeftOvers = $pdf->addTextWrap(50,$YPos,500,$FontSize,_('Signed On Behalf Of').' : '.$_SESSION['CompanyRecord']['coyname']); + +$YPos=$YPos-($line_height*10); + +$LeftOvers = $pdf->addTextWrap(50,$YPos,300,$FontSize,'______________________________________________________________________________'); + +$pdf->Output('Receipt-'.$_GET['ReceiptNumber'], 'I'); +?> \ No newline at end of file Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-18 07:47:54 UTC (rev 3041) +++ trunk/doc/Change.log.html 2009-11-18 10:17:55 UTC (rev 3042) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>18/11/09 Tim: PDFReceipt.php - Provide option to print a customer receipt <p>17/11/09 Bryan Nielsen: Factors.php - Correction first factor does not show in amend list <p>17/11/09 Tim: WWW_Users.php - Alter directory listing for svn directory <p>17/11/09 Tim: UserSettings.php - Alter directory listing for svn directory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-18 13:07:29
|
Revision: 3044 http://web-erp.svn.sourceforge.net/web-erp/?rev=3044&view=rev Author: tim_schofield Date: 2009-11-18 13:07:23 +0000 (Wed, 18 Nov 2009) Log Message: ----------- Provide option to just view a customers details Modified Paths: -------------- trunk/Customers.php trunk/SelectCustomer.php trunk/doc/Change.log.html Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2009-11-18 11:28:44 UTC (rev 3043) +++ trunk/Customers.php 2009-11-18 13:07:23 UTC (rev 3044) @@ -624,37 +624,57 @@ <td><input ' . (in_array('DebtorNo',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="DebtorNo" value="' . $DebtorNo . '" size=12 maxlength=10></td></tr>'; } } - - echo '<tr><td>' . _('Customer Name') . ':</td> - <td><input ' . (in_array('CustName',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="CustName" value="' . $_POST['CustName'] . '" size=42 maxlength=40></td></tr>'; - echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td> - <td><input ' . (in_array('Address1',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address1" size=42 maxlength=40 value="' . $_POST['Address1'] . '"></td></tr>'; - echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td> - <td><input ' . (in_array('Address2',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address2" size=42 maxlength=40 value="' . $_POST['Address2'] . '"></td></tr>'; - echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td> - <td><input ' . (in_array('Address3',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address3" size=42 maxlength=40 value="' . $_POST['Address3'] . '"></td></tr>'; - echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td> - <td><input ' . (in_array('Address4',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address4" size=42 maxlength=40 value="' . $_POST['Address4'] . '"></td></tr>'; - echo '<tr><td>' . _('Address Line 5') . ':</td> - <td><input ' . (in_array('Address5',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address5" size=42 maxlength=40 value="' . $_POST['Address5'] . '"></td></tr>'; - echo '<tr><td>' . _('Address Line 6') . ':</td> - <td><input ' . (in_array('Address6',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address6" size=42 maxlength=40 value="' . $_POST['Address6'] . '"></td></tr>'; - echo '</table></td><td><table>'; - + if (isset($_GET['Modify'])) { + echo '<tr><td>' . _('Customer Name') . ':</td><td>' . $_POST['CustName'] . '</td></tr>'; + echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td><td>' . $_POST['Address1'] . '</td></tr>'; + echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td><td>' . $_POST['Address2'] . '</td></tr>'; + echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td><td>' . $_POST['Address3'] . '</td></tr>'; + echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td><td>' . $_POST['Address4'] . '</td></tr>'; + echo '<tr><td>' . _('Address Line 5') . ':</td><td>' . $_POST['Address5'] . '</td></tr>'; + echo '<tr><td>' . _('Address Line 6') . ':</td><td>' . $_POST['Address6'] . '</td></tr>'; + echo '</table></td><td><table>'; + } else { + echo '<tr><td>' . _('Customer Name') . ':</td> + <td><input ' . (in_array('CustName',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="CustName" value="' . $_POST['CustName'] . '" size=42 maxlength=40></td></tr>'; + echo '<tr><td>' . _('Address Line 1 (Street)') . ':</td> + <td><input ' . (in_array('Address1',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address1" size=42 maxlength=40 value="' . $_POST['Address1'] . '"></td></tr>'; + echo '<tr><td>' . _('Address Line 2 (Suburb/City)') . ':</td> + <td><input ' . (in_array('Address2',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address2" size=42 maxlength=40 value="' . $_POST['Address2'] . '"></td></tr>'; + echo '<tr><td>' . _('Address Line 3 (State/Province)') . ':</td> + <td><input ' . (in_array('Address3',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address3" size=42 maxlength=40 value="' . $_POST['Address3'] . '"></td></tr>'; + echo '<tr><td>' . _('Address Line 4 (Postal Code)') . ':</td> + <td><input ' . (in_array('Address4',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address4" size=42 maxlength=40 value="' . $_POST['Address4'] . '"></td></tr>'; + echo '<tr><td>' . _('Address Line 5') . ':</td> + <td><input ' . (in_array('Address5',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address5" size=42 maxlength=40 value="' . $_POST['Address5'] . '"></td></tr>'; + echo '<tr><td>' . _('Address Line 6') . ':</td> + <td><input ' . (in_array('Address6',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="Address6" size=42 maxlength=40 value="' . $_POST['Address6'] . '"></td></tr>'; + echo '</table></td><td><table>'; + } // Select sales types for drop down list - $result=DB_query('SELECT typeabbrev, sales_type FROM salestypes ',$db); - echo '<tr><td>' . _('Sales Type') . '/' . _('Price List') . ":</td> - <td><select name='SalesType'>"; - while ($myrow = DB_fetch_array($result)) { - if ($_POST['SalesType']==$myrow['typeabbrev']){ - echo "<option selected value='". $myrow['typeabbrev'] . "'>" . $myrow['sales_type']; - } else { - echo "<option value='". $myrow['typeabbrev'] . "'>" . $myrow['sales_type']; - } - } //end while loop - DB_data_seek($result,0); + if (isset($_GET['Modify'])) { + $result=DB_query('SELECT sales_type FROM salestypes WHERE typeabbrev="'.$_POST['SalesType'].'"',$db); + $myrow=DB_fetch_array($result); + echo '<tr><td>' . _('Sales Type') . ":</td><td>".$myrow['sales_type']."</td></tr>"; + } else { + $result=DB_query('SELECT typeabbrev, sales_type FROM salestypes ',$db); + echo '<tr><td>' . _('Sales Type') . '/' . _('Price List') . ":</td> + <td><select name='SalesType'>"; + while ($myrow = DB_fetch_array($result)) { + if ($_POST['SalesType']==$myrow['typeabbrev']){ + echo "<option selected value='". $myrow['typeabbrev'] . "'>" . $myrow['sales_type']; + } else { + echo "<option value='". $myrow['typeabbrev'] . "'>" . $myrow['sales_type']; + } + } //end while loop + DB_data_seek($result,0); + } // Select Customer types for drop down list for SELECT/UPDATE + if (isset($_GET['Modify'])) { + $result=DB_query('SELECT typename FROM debtortype WHERE typeid='.$_POST['typeid'],$db); + $myrow=DB_fetch_array($result); + echo '<tr><td>' . _('Customer Type') . ":</td><td>".$myrow['typename']."</td></tr>"; + } else { $result=DB_query('SELECT typeid, typename FROM debtortype ORDER BY typename',$db); echo '<tr><td>' . _('Customer Type') . ":</td> <td><select name='typeid'>"; @@ -666,86 +686,126 @@ } } //end while loop DB_data_seek($result,0); + } - echo '</select></td></tr> - <tr><td>' . _('Customer Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> - <td><input ' . (in_array('ClientSince',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ClientSince" size=11 maxlength=10 value=' . $_POST['ClientSince'] . '></td></tr>'; - echo '<tr><td>' . _('Discount Percent') . ':</td> - <td><input type="Text" name="Discount" class=number size=5 maxlength=4 value=' . $_POST['Discount'] . '></td></tr>'; - echo '<tr><td>' . _('Discount Code') . ':</td> - <td><input ' . (in_array('DiscountCode',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="DiscountCode" size=3 maxlength=2 value="' . $_POST['DiscountCode'] . '"></td></tr>'; - echo '<tr><td>' . _('Payment Discount Percent') . ':</td> + if (isset($_GET['Modify'])) { + echo '</select></td></tr> + <tr><td>' . _('Customer Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td><td>' . $_POST['ClientSince'] . '</td></tr>'; + echo '<tr><td>' . _('Discount Percent') . ':</td><td>' . $_POST['Discount'] . '</td></tr>'; + echo '<tr><td>' . _('Discount Code') . ':</td><td>' . $_POST['DiscountCode'] . '</td></tr>'; + echo '<tr><td>' . _('Payment Discount Percent') . ':</td><td>' . $_POST['PymtDiscount'] . '</td></tr>'; + echo '<tr><td>' . _('Credit Limit') . ':</td><td>' . number_format($_POST['CreditLimit'],2) . '</td></tr>'; + echo '<tr><td>' . _('Tax Reference') . ':</td><td>' . $_POST['TaxRef'] . '</td></tr>'; + } else { + echo '</select></td></tr> + <tr><td>' . _('Customer Since') . ' (' . $_SESSION['DefaultDateFormat'] . '):</td> + <td><input ' . (in_array('ClientSince',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" class="date" alt="'.$_SESSION['DefaultDateFormat'].'" name="ClientSince" size=11 maxlength=10 value=' . $_POST['ClientSince'] . '></td></tr>'; + echo '<tr><td>' . _('Discount Percent') . ':</td> + <td><input type="Text" name="Discount" class=number size=5 maxlength=4 value=' . $_POST['Discount'] . '></td></tr>'; + echo '<tr><td>' . _('Discount Code') . ':</td> + <td><input ' . (in_array('DiscountCode',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" name="DiscountCode" size=3 maxlength=2 value="' . $_POST['DiscountCode'] . '"></td></tr>'; + echo '<tr><td>' . _('Payment Discount Percent') . ':</td> <td><input ' . (in_array('PymtDiscount',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" class=number name="PymtDiscount" size=5 maxlength=4 value=' . $_POST['PymtDiscount'] . '></td></tr>'; - echo '<tr><td>' . _('Credit Limit') . ':</td> - <td><input ' . (in_array('CreditLimit',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" class=number name="CreditLimit" size=16 maxlength=14 value=' . $_POST['CreditLimit'] . '></td></tr>'; - echo '<tr><td>' . _('Tax Reference') . ':</td> - <td><input type="Text" name="TaxRef" size=22 maxlength=20 value="' . $_POST['TaxRef'] . '"></td></tr>'; - $result=DB_query('SELECT terms, termsindicator FROM paymentterms',$db); + echo '<tr><td>' . _('Credit Limit') . ':</td> + <td><input ' . (in_array('CreditLimit',$Errors) ? 'class="inputerror"' : '' ) .' type="Text" class=number name="CreditLimit" size=16 maxlength=14 value=' . $_POST['CreditLimit'] . '></td></tr>'; + echo '<tr><td>' . _('Tax Reference') . ':</td> + <td><input type="Text" name="TaxRef" size=22 maxlength=20 value="' . $_POST['TaxRef'] . '"></td></tr>'; + } + + if (isset($_GET['Modify'])) { + $result=DB_query('SELECT terms FROM paymentterms WHERE termsindicator='.$_POST['PaymentTerms'],$db); + $myrow=DB_fetch_array($result); + echo '<tr><td>' . _('Payment Terms') . ":</td><td>".$myrow['terms']."</td></tr>"; + } else { + $result=DB_query('SELECT terms, termsindicator FROM paymentterms',$db); + echo '<tr><td>' . _('Payment Terms') . ":</td> + <td><select name='PaymentTerms'>"; + while ($myrow = DB_fetch_array($result)) { + if ($_POST['PaymentTerms']==$myrow['termsindicator']){ + echo "<option selected VALUE=". $myrow['termsindicator'] . '>' . $myrow['terms']; + } else { + echo '<option VALUE='. $myrow['termsindicator'] . '>' . $myrow['terms']; + } + } //end while loop + DB_data_seek($result,0); + echo '</select></td></tr>'; + } - echo '<tr><td>' . _('Payment Terms') . ":</td> - <td><select name='PaymentTerms'>"; + if (isset($_GET['Modify'])) { + $result=DB_query('SELECT reasondescription FROM holdreasons WHERE reasoncode="'.$_POST['HoldReason'].'"',$db); + $myrow=DB_fetch_array($result); + echo '<tr><td>' . _('Credit Status') . ":</td><td>".$myrow['reasondescription']."</td></tr>"; + } else { + $result=DB_query('SELECT reasoncode, reasondescription FROM holdreasons',$db); + echo '<tr><td>' . _('Credit Status') . ":</td> + <td><select name='HoldReason'>"; + while ($myrow = DB_fetch_array($result)) { + if ($_POST['HoldReason']==$myrow['reasoncode']){ + echo '<option selected VALUE='. $myrow['reasoncode'] . '>' . $myrow['reasondescription']; + } else { + echo '<option VALUE='. $myrow['reasoncode'] . '>' . $myrow['reasondescription']; + } + } //end while loop + DB_data_seek($result,0); + echo '</select></td></tr>'; + } - while ($myrow = DB_fetch_array($result)) { - if ($_POST['PaymentTerms']==$myrow['termsindicator']){ - echo "<option selected VALUE=". $myrow['termsindicator'] . '>' . $myrow['terms']; + if (isset($_GET['Modify'])) { + $result=DB_query('SELECT currency FROM currencies WHERE currabrev="'.$_POST['CurrCode'].'"',$db); + $myrow=DB_fetch_array($result); + echo '<tr><td>' . _('Credit Status') . ":</td><td>".$myrow['currency']."</td></tr>"; + } else { + $result=DB_query('SELECT currency, currabrev FROM currencies',$db); + echo '<tr><td>' . _('Customers Currency') . ":</td> + <td><select name='CurrCode'>"; + while ($myrow = DB_fetch_array($result)) { + if ($_POST['CurrCode']==$myrow['currabrev']){ + echo '<option selected value='. $myrow['currabrev'] . '>' . $myrow['currency']; + } else { + echo '<option value='. $myrow['currabrev'] . '>' . $myrow['currency']; + } + } //end while loop + DB_data_seek($result,0); + echo '</select></td></tr>'; + } + /*added lines 8/23/2007 by Morris Kelly to get po line parameter Y/N*/ + if (isset($_GET['Modify'])) { + if ($_POST['CustomerPOLine']==0){ + echo '<tr><td>' . _('Credit Status') . ":</td><td>"._('No')."</td></tr>"; } else { - echo '<option VALUE='. $myrow['termsindicator'] . '>' . $myrow['terms']; + echo '<tr><td>' . _('Credit Status') . ":</td><td>"._('Yes')."</td></tr>"; } - } //end while loop - DB_data_seek($result,0); - - $result=DB_query('SELECT reasoncode, reasondescription FROM holdreasons',$db); - - echo '</select></td></tr><tr><td>' . _('Credit Status') . ":</td> - <td><select name='HoldReason'>"; - while ($myrow = DB_fetch_array($result)) { - - if ($_POST['HoldReason']==$myrow['reasoncode']){ - echo '<option selected VALUE='. $myrow['reasoncode'] . '>' . $myrow['reasondescription']; + } else { + echo '<tr><td>' . _('Require Customer PO Line on SO') . ":</td> + <td><select name='CustomerPOLine'>"; + if ($_POST['CustomerPOLine']==0){ + echo '<option selected value=0>' . _('No'); + echo '<option value=1>' . _('Yes'); } else { - echo '<option VALUE='. $myrow['reasoncode'] . '>' . $myrow['reasondescription']; + echo '<option value=0>' . _('No'); + echo '<option selected value=1>' . _('Yes'); } - - } //end while loop - DB_data_seek($result,0); - - $result=DB_query('SELECT currency, currabrev FROM currencies',$db); - - echo '</select></td></tr> - <tr><td>' . _('Customers Currency') . ":</td> - <td><select name='CurrCode'>"; - while ($myrow = DB_fetch_array($result)) { - if ($_POST['CurrCode']==$myrow['currabrev']){ - echo '<option selected value='. $myrow['currabrev'] . '>' . $myrow['currency']; + echo '</select></td></tr>'; + } + + if (isset($_GET['Modify'])) { + if ($_POST['CustomerPOLine']==0){ + echo '<tr><td>' . _('Invoice Addressing') . ":</td><td>"._('Address to HO')."</td></tr>"; } else { - echo '<option value='. $myrow['currabrev'] . '>' . $myrow['currency']; + echo '<tr><td>' . _('Invoice Addressing') . ":</td><td>"._('Address to Branch')."</td></tr>"; } - } //end while loop - DB_data_seek($result,0); - echo '</select></td></tr>'; - - /*added lines 8/23/2007 by Morris Kelly to get po line parameter Y/N*/ - echo '<tr><td>' . _('Require Customer PO Line on SO') . ":</td> - <td><select name='CustomerPOLine'>"; - if ($_POST['CustomerPOLine']==0){ - echo '<option selected value=0>' . _('No'); - echo '<option value=1>' . _('Yes'); } else { - echo '<option value=0>' . _('No'); - echo '<option selected value=1>' . _('Yes'); + echo '<tr><td>' . _('Invoice Addressing') . ":</td> + <td><select name='AddrInvBranch'>"; + if ($_POST['InvAddrBranch']==0){ + echo '<option selected VALUE=0>' . _('Address to HO'); + echo '<option VALUE=1>' . _('Address to Branch'); + } else { + echo '<option VALUE=0>' . _('Address to HO'); + echo '<option selected VALUE=1>' . _('Address to Branch'); + } } - echo '</select></td></tr>'; - echo '<tr><td>' . _('Invoice Addressing') . ":</td> - <td><select name='AddrInvBranch'>"; - if ($_POST['InvAddrBranch']==0){ - echo '<option selected VALUE=0>' . _('Address to HO'); - echo '<option VALUE=1>' . _('Address to Branch'); - } else { - echo '<option VALUE=0>' . _('Address to HO'); - echo '<option selected VALUE=1>' . _('Address to Branch'); - } - echo '</select></td></tr></table></td></tr>'; echo '<tr><td colspan=2>'; @@ -753,14 +813,21 @@ $result = DB_query($sql,$db); echo '<table border=1>'; - echo '<tr> + if (isset($_GET['Modify'])) { + echo '<tr> <th>' . _('Name') . '</th> <th>' . _('Role') . '</th> <th>' . _('Phone Number') . '</th> + <th>' . _('Notes') . '</th></tr>'; + } else { + echo '<tr> + <th>' . _('Name') . '</th> + <th>' . _('Role') . '</th> + <th>' . _('Phone Number') . '</th> <th>' . _('Notes') . '</th> <th>' . _('Edit') . '</th> <th colspan=2><input type="Submit" name="addcontact" VALUE="Add Contact"></th></tr>'; - + } $k=0; //row colour counter while ($myrow = DB_fetch_array($result)) { @@ -772,10 +839,24 @@ $k=1; } - printf('<td>%s</td> + if (isset($_GET['Modify'])) { + printf('<td>%s</td> <td>%s</td> <td>%s</td> <td>%s</td> + </tr>', + $myrow[2], + $myrow[3], + $myrow[4], + $myrow[5], + $myrow[0], + $myrow[1], + $myrow[1]); + } else { + printf('<td>%s</td> + <td>%s</td> + <td>%s</td> + <td>%s</td> <td><a href="AddCustomerContacts.php?Id=%s&DebtorNo=%s">'. _('Edit'). '</a></td> <td><a href="%sID=%s&DebtorNo=%s&delete=1">'. _('Delete'). '</a></td> </tr>', @@ -788,7 +869,7 @@ $_SERVER['PHP_SELF'] . "?" . SID, $myrow[0], $myrow[1]); - + } }//END WHILE LIST LOOP echo '</table>'; // echo "<input type='Submit' name='addcontact' VALUE='" . _('ADD Contact') . "'>"; @@ -844,7 +925,7 @@ if (isset($_POST['New']) and $_POST['New']) { echo "<div class='centre'><input type='Submit' name='submit' VALUE='" . _('Add New Customer') . "'><br><input type=submit name='reset' VALUE='" . _('Reset') . "'></form>"; - } else { + } else if (!isset($_GET['Modify'])){ echo "<hr><div class='centre'><input type='Submit' name='submit' VALUE='" . _('Update Customer') . "'>"; echo '<p><input type="Submit" name="delete" VALUE="' . _('Delete Customer') . '" onclick="return confirm(\'' . _('Are You Sure?') . '\');">'; } Modified: trunk/SelectCustomer.php =================================================================== --- trunk/SelectCustomer.php 2009-11-18 11:28:44 UTC (rev 3043) +++ trunk/SelectCustomer.php 2009-11-18 13:07:23 UTC (rev 3044) @@ -291,6 +291,7 @@ echo '<tr><td WIDTH=50% class="menu_group_items">'; /* Customer Inquiry Options */ echo '<a href="' . $rootpath . '/CustomerInquiry.php?CustomerID=' . $_SESSION['CustomerID'] . '">' . _('Customer Transaction Inquiries') . '</a><br>'; + echo '<a href="' . $rootpath . '/Customers.php?DebtorNo=' . $_SESSION['CustomerID'] . '&Modify=No">' . _('View Customer Details') . '</a><br>'; echo '<a href="' . $rootpath . '/PrintCustStatements.php?FromCust=' . $_SESSION['CustomerID'] . '&ToCust=' . $_SESSION['CustomerID'] . '&PrintPDF=Yes">' . _('Print Customer Statement') . '</a><br>'; echo '<a href="' . $rootpath . '/SelectSalesOrder.php?SelectedCustomer=' . $_SESSION['CustomerID'] . '">' . _('Modify Outstanding Sales Orders') . '</a><br>'; echo '<a href="' . $rootpath . '/SelectCompletedOrder.php?SelectedCustomer=' . $_SESSION['CustomerID'] . '">' . _('Order Inquiries') . '</a><br>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-18 11:28:44 UTC (rev 3043) +++ trunk/doc/Change.log.html 2009-11-18 13:07:23 UTC (rev 3044) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>18/11/09 Tim: Customers.php - Provide option to just view a customers details <p>18/11/09 Tim: PDFReceipt.php - Provide option to print a customer receipt <p>17/11/09 Bryan Nielsen: Factors.php - Correction first factor does not show in amend list <p>17/11/09 Tim: WWW_Users.php - Alter directory listing for svn directory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-18 14:21:53
|
Revision: 3046 http://web-erp.svn.sourceforge.net/web-erp/?rev=3046&view=rev Author: tim_schofield Date: 2009-11-18 14:21:39 +0000 (Wed, 18 Nov 2009) Log Message: ----------- Provide for better error handling when price lists and customer types are not setup. Modified Paths: -------------- trunk/Customers.php trunk/doc/Change.log.html Modified: trunk/Customers.php =================================================================== --- trunk/Customers.php 2009-11-18 13:13:36 UTC (rev 3045) +++ trunk/Customers.php 2009-11-18 14:21:39 UTC (rev 3046) @@ -394,6 +394,34 @@ /*If the page was called without $_POST['DebtorNo'] passed to page then assume a new customer is to be entered show a form with a Debtor Code field other wise the form showing the fields with the existing entries against the customer will show for editing with only a hidden DebtorNo field*/ +/* First check that all the necessary items have been setup */ + + $SetupErrors=0; //Count errors + $sql='SELECT COUNT(typeabbrev) + FROM salestypes'; + $result=DB_query($sql, $db); + $myrow=DB_fetch_row($result); + if ($myrow[0]==0) { + prnMsg( _('In order to create a new customer you must first set up at least one sales type/price list').'<br />'. + _('Click').' '.'<a target="_blank" href="' . $rootpath . '/SalesTypes.php">' . _('here').' ' . '</a>'._('to set up your price lists'),'warning').'<br />'; + $SetupErrors += 1; + } + $sql='SELECT COUNT(typeid) + FROM debtortype'; + $result=DB_query($sql, $db); + $myrow=DB_fetch_row($result); + if ($myrow[0]==0) { + prnMsg( _('In order to create a new customer you must first set up at least one customer type').'<br />'. + _('Click').' '.'<a target="_blank" href="' . $rootpath . '/CustomerTypes.php">' . _('here').' ' . '</a>'._('to set up your customer types'),'warning'); + $SetupErrors += 1; + } + + if ($SetupErrors>0) { + echo '<br /><div class=centre><a href="'.$_SERVER['PHP_SELF'] .'" >'._('Click here to continue').'</a></div>'; + include('includes/footer.inc'); + exit; + } + echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '>'; echo "<input type='Hidden' name='New' value='Yes'>"; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-18 13:13:36 UTC (rev 3045) +++ trunk/doc/Change.log.html 2009-11-18 14:21:39 UTC (rev 3046) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>18/11/09 Tim: Customers.php - Provide for better error handling when price lists and customer types are not setup. <p>18/11/09 Tim: Customers.php - Provide option to just view a customers details <p>18/11/09 Tim: PDFReceipt.php - Provide option to print a customer receipt <p>17/11/09 Bryan Nielsen: Factors.php - Correction first factor does not show in amend list This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-18 14:43:49
|
Revision: 3047 http://web-erp.svn.sourceforge.net/web-erp/?rev=3047&view=rev Author: tim_schofield Date: 2009-11-18 14:43:40 +0000 (Wed, 18 Nov 2009) Log Message: ----------- Include payment terms on the order. Modified Paths: -------------- trunk/PO_PDFPurchOrder.php trunk/doc/Change.log.html trunk/includes/PO_PDFOrderPageHeader.inc Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2009-11-18 14:21:39 UTC (rev 3046) +++ trunk/PO_PDFPurchOrder.php 2009-11-18 14:43:40 UTC (rev 3047) @@ -86,6 +86,7 @@ purchorders.allowprint, purchorders.requisitionno, purchorders.initiator, + purchorders.paymentterms, suppliers.currcode FROM purchorders INNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-18 14:21:39 UTC (rev 3046) +++ trunk/doc/Change.log.html 2009-11-18 14:43:40 UTC (rev 3047) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>18/11/09 Tim: PO_PDFOrderPageHeader.inc - Include payment terms on the order. <p>18/11/09 Tim: Customers.php - Provide for better error handling when price lists and customer types are not setup. <p>18/11/09 Tim: Customers.php - Provide option to just view a customers details <p>18/11/09 Tim: PDFReceipt.php - Provide option to print a customer receipt Modified: trunk/includes/PO_PDFOrderPageHeader.inc =================================================================== --- trunk/includes/PO_PDFOrderPageHeader.inc 2009-11-18 14:21:39 UTC (rev 3046) +++ trunk/includes/PO_PDFOrderPageHeader.inc 2009-11-18 14:43:40 UTC (rev 3047) @@ -56,7 +56,6 @@ $pdf->addText($XPos+2,$YPos-(3*$line_height), $FontSize, $POHeader['deladd3'] . ' ' . $POHeader['deladd4'] . ' ' . $POHeader['deladd5']); $pdf->addText($XPos+2,$YPos-(4*$line_height), $FontSize, $POHeader['deladd6']); - /*draw a nice curved corner box around the delivery to address */ /*from the top right */ $pdf->partEllipse($XPos+250-10,$YPos+10,0,90,10,10); @@ -124,6 +123,11 @@ $LeftOvers = $pdf->addTextWrap($XPos, $YPos-$line_height,250,$FontSize,$LeftOvers, 'left'); } +$sql='SELECT terms FROM paymentterms where termsindicator="'.$POHeader['paymentterms'].'"'; +$result=DB_query($sql, $db); +$myrow=DB_fetch_array($result); +$pdf->addText($XPos+2,$YPos-($line_height), $FontSize, _('Payment Terms').' : '.$myrow['terms']); + $XPos = $Left_Margin; $YPos -= ($line_height*2); $pdf->addText($Left_Margin,$YPos, $FontSize, _('All amounts stated in').' - ' . $POHeader['currcode']); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-18 20:07:01
|
Revision: 3048 http://web-erp.svn.sourceforge.net/web-erp/?rev=3048&view=rev Author: tim_schofield Date: 2009-11-18 20:06:51 +0000 (Wed, 18 Nov 2009) Log Message: ----------- Add direct link to raise a Purchase Order Modified Paths: -------------- trunk/PO_Header.php trunk/SelectSupplier.php trunk/doc/Change.log.html Modified: trunk/PO_Header.php =================================================================== --- trunk/PO_Header.php 2009-11-18 14:43:40 UTC (rev 3047) +++ trunk/PO_Header.php 2009-11-18 20:06:51 UTC (rev 3048) @@ -43,6 +43,10 @@ $title = _('Purchase Order Entry'); } +if (isset($_GET['SupplierID'])) { + $_POST['Select']=$_GET['SupplierID']; +} + include('includes/header.inc'); include('includes/SQL_CommonFunctions.inc'); Modified: trunk/SelectSupplier.php =================================================================== --- trunk/SelectSupplier.php 2009-11-18 14:43:40 UTC (rev 3047) +++ trunk/SelectSupplier.php 2009-11-18 20:06:51 UTC (rev 3048) @@ -193,6 +193,7 @@ echo "<br><a href='$rootpath/Shipt_Select.php?" . SID . '&SelectedSupplier=' . $_SESSION['SupplierID'] . "'>" . _('Search / Modify / Close Shipments') . '</a>'; echo "<br><a href='$rootpath/SuppPriceList.php?" . SID . '&SelectedSupplier=' . $_SESSION['SupplierID'] . "'>" . _('Supplier Price List') . '</a>'; echo '</td><td VALIGN=TOP class="menu_group_items">'; /* Supplier Transactions */ + echo "<a href=\"$rootpath/PO_Header.php?" . SID . '&NewOrder=Yes&SupplierID=' . $_SESSION['SupplierID'] . "\">" . _('Enter a Purchase Order for This Supplier') . '</a><br>'; echo "<a href=\"$rootpath/SupplierInvoice.php?" . SID . '&SupplierID=' . $_SESSION['SupplierID'] . "\">" . _('Enter a Suppliers Invoice') . '</a><br>'; echo "<a href=\"$rootpath/SupplierCredit.php?" . SID . '&SupplierID=' . $_SESSION['SupplierID'] . "\">" . _('Enter a Suppliers Credit Note') . '</a><br>'; echo "<a href=\"$rootpath/Payments.php?" . SID . '&SupplierID=' . $_SESSION['SupplierID'] . "\">" . _('Enter a Payment to, or Receipt from the Supplier') . '</a><br>'; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-18 14:43:40 UTC (rev 3047) +++ trunk/doc/Change.log.html 2009-11-18 20:06:51 UTC (rev 3048) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>18/11/09 Tim: PO_Header.php - Add direct link to raise a Purchase Order <p>18/11/09 Tim: PO_PDFOrderPageHeader.inc - Include payment terms on the order. <p>18/11/09 Tim: Customers.php - Provide for better error handling when price lists and customer types are not setup. <p>18/11/09 Tim: Customers.php - Provide option to just view a customers details This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-18 21:32:22
|
Revision: 3049 http://web-erp.svn.sourceforge.net/web-erp/?rev=3049&view=rev Author: tim_schofield Date: 2009-11-18 21:32:16 +0000 (Wed, 18 Nov 2009) Log Message: ----------- Correction to jelly theme Modified Paths: -------------- trunk/css/jelly/default.css trunk/doc/Change.log.html Modified: trunk/css/jelly/default.css =================================================================== --- trunk/css/jelly/default.css 2009-11-18 20:06:51 UTC (rev 3048) +++ trunk/css/jelly/default.css 2009-11-18 21:32:16 UTC (rev 3049) @@ -50,8 +50,8 @@ table { background: #eee; border: 0px 0px 2px 2px #222 solid; + margin: 0 auto; background: #eee; - margin: 0 auto; } .dpTbl { @@ -295,17 +295,17 @@ width:90%; background: #eee; border: 0px 0px 2px 2px #222 solid; - background: #eee; margin: 0 auto; } + /* Table type is used for UI tables type 2 */ .table2 { width:90%; background: #eee; border: 0px 0px 2px 2px #222 solid; - background: #eee; margin: 0 auto; } + input.address3 { text-transform: uppercase; } @@ -458,7 +458,7 @@ } .main_menu { -background:none; + background:none; border: 0px; height:28px; } @@ -569,18 +569,19 @@ .menu_group_items { vertical-align: top; border: none; - padding: 10px; + padding: 10px } .menu_group_item { padding-top: 2px; - padding-bottom: 2px; + background: #eee; + padding-bottom: 2px } .menu_group_item p { color: #00f; /* This is the color for bullets, I like it to be the same as the anchor color, but it's up to you */ text-indent: -12px; /* this makes the bullet to appear as the li tag previously used */ - margin: 0 0 0 12px; /* One thing that I didn´t like of the li was that it had no left margin applied */ + margin: 0 0 0 12px;/* One thing that I didn´t like of the li was that it had no left margin applied */ } .page_title_text { Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-18 20:06:51 UTC (rev 3048) +++ trunk/doc/Change.log.html 2009-11-18 21:32:16 UTC (rev 3049) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>18/11/09 Tim: default.css - Correction to jelly theme <p>18/11/09 Tim: PO_Header.php - Add direct link to raise a Purchase Order <p>18/11/09 Tim: PO_PDFOrderPageHeader.inc - Include payment terms on the order. <p>18/11/09 Tim: Customers.php - Provide for better error handling when price lists and customer types are not setup. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-19 11:49:57
|
Revision: 3051 http://web-erp.svn.sourceforge.net/web-erp/?rev=3051&view=rev Author: tim_schofield Date: 2009-11-19 11:49:22 +0000 (Thu, 19 Nov 2009) Log Message: ----------- Improvements to factor company implementaton. Modified Paths: -------------- trunk/Factors.php trunk/Suppliers.php trunk/doc/Change.log.html trunk/sql/mysql/upgrade3.11-3.12.sql Modified: trunk/Factors.php =================================================================== --- trunk/Factors.php 2009-11-19 06:17:13 UTC (rev 3050) +++ trunk/Factors.php 2009-11-19 11:49:22 UTC (rev 3051) @@ -1,44 +1,34 @@ <?php - $PageSecurity = 5; - -include('includes/session.inc'); - +include ('includes/session.inc'); $title = _('Factor Company Maintenance'); - -include('includes/header.inc'); - -if (isset($_GET['FactorID'])){ - $FactorID = strtoupper($_GET['FactorID']); -} elseif (isset($_POST['FactorID'])){ - $FactorID = strtoupper($_POST['FactorID']); +include ('includes/header.inc'); +echo '<p class="page_title_text"><img src="'.$rootpath.'/css/'.$theme.'/images/supplier.png" title="' . _('Search') . '" alt="">' . ' ' . _('Factor Company Maintenance') . ''; +if (isset($_GET['FactorID'])) { + $FactorID = strtoupper($_GET['FactorID']); +} elseif (isset($_POST['FactorID'])) { + $FactorID = strtoupper($_POST['FactorID']); } else { - unset($FactorID); + unset($FactorID); } - if (isset($_POST['Create'])) { - $FactorID = 0; - $_POST['New'] = "Yes"; + $FactorID = 0; + $_POST['New'] = "Yes"; }; - if (isset($_POST['submit'])) { - - /* This section has been reached because the user has pressed either the insert/update buttons on the - form hopefully with input in the correct fields, which we check for firsrt. */ - - //initialise no input errors assumed initially before we test - $InputError = 0; - - if (strlen($_POST['FactorName']) > 40 or strlen($_POST['FactorName']) == 0 or $_POST['FactorName'] == '') { - $InputError = 1; - prnMsg(_('The factoring company name must be entered and be forty characters or less long'),'error'); - } - - /* If no input errors have been recieved */ - if ($InputError != 1){ - //And if its not a new part then update existing one - if (!isset($_POST['New'])) { - $sql = "UPDATE factorcompanies SET coyname='" . $_POST['FactorName'] . "', + /* This section has been reached because the user has pressed either the insert/update buttons on the + form hopefully with input in the correct fields, which we check for firsrt. */ + //initialise no input errors assumed initially before we test + $InputError = 0; + if (strlen($_POST['FactorName']) > 40 or strlen($_POST['FactorName']) == 0 or $_POST['FactorName'] == '') { + $InputError = 1; + prnMsg(_('The factoring company name must be entered and be forty characters or less long'), 'error'); + } + /* If no input errors have been recieved */ + if ($InputError != 1) { + //And if its not a new part then update existing one + if (!isset($_POST['New'])) { + $sql = "UPDATE factorcompanies SET coyname='" . $_POST['FactorName'] . "', address1='" . $_POST['Address1'] . "', address2='" . $_POST['Address2'] . "', address3='" . $_POST['Address3'] . "', @@ -49,19 +39,15 @@ telephone='" . $_POST['Telephone'] . "', fax='" . $_POST['Fax'] . "', email='" . $_POST['Email'] . " ' - WHERE id = " .$FactorID; - - $ErrMsg = _('The factoring company could not be updated because'); - $DbgMsg = _('The SQL that was used to update the factor but failed was'); - - $result = DB_query($sql, $db, $ErrMsg, $DbgMsg); - - prnMsg(_('The factoring company record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been updated'),'success'); - - //If it is a new part then insert it - } else { - - $sql = "INSERT INTO factorcompanies (id, + WHERE id = " . $FactorID; + $ErrMsg = _('The factoring company could not be updated because'); + $DbgMsg = _('The SQL that was used to update the factor but failed was'); + $result = DB_query($sql, $db, $ErrMsg, $DbgMsg); + prnMsg(_('The factoring company record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been updated'), 'success'); + //If it is a new part then insert it + + } else { + $sql = "INSERT INTO factorcompanies (id, coyname, address1, address2, @@ -74,7 +60,7 @@ fax, email) VALUES (null, - '" .$_POST['FactorName'] . "', + '" . $_POST['FactorName'] . "', '" . $_POST['Address1'] . "', '" . $_POST['Address2'] . "', '" . $_POST['Address3'] . "', @@ -84,90 +70,75 @@ '" . $_POST['ContactName'] . "', '" . $_POST['Telephone'] . "', '" . $_POST['Fax'] . "', - '" . $_POST['Email'] . "')"; - - $ErrMsg = _('The factoring company') . ' ' . $_POST['FactorName'] . ' ' . _('could not be added because'); - $DbgMsg = _('The SQL that was used to insert the factor but failed was'); - - $result = DB_query($sql, $db, $ErrMsg, $DbgMsg); - - prnMsg(_('A new factoring company for') . ' ' . $_POST['FactorName'] . ' ' . _('has been added to the database'),'success'); - - unset ($FactorID); - unset($_POST['FactorName']); - unset($_POST['Address1']); - unset($_POST['Address2']); - unset($_POST['Address3']); - unset($_POST['Address4']); - unset($_POST['Address5']); - unset($_POST['Address6']); - unset($_POST['ContactName']); - unset($_POST['Telephone']); - unset($_POST['Fax']); - unset($_POST['Email']); - - } - // But if errors were found in the input - } else { - prnMsg(_('Validation failed') . _('no updates or deletes took place'),'warn'); - } - -/* If neither the Update or Insert buttons were pushed was it the delete button? */ - + '" . $_POST['Email'] . "')"; + $ErrMsg = _('The factoring company') . ' ' . $_POST['FactorName'] . ' ' . _('could not be added because'); + $DbgMsg = _('The SQL that was used to insert the factor but failed was'); + $result = DB_query($sql, $db, $ErrMsg, $DbgMsg); + prnMsg(_('A new factoring company for') . ' ' . $_POST['FactorName'] . ' ' . _('has been added to the database'), 'success'); + unset($FactorID); + unset($_POST['FactorName']); + unset($_POST['Address1']); + unset($_POST['Address2']); + unset($_POST['Address3']); + unset($_POST['Address4']); + unset($_POST['Address5']); + unset($_POST['Address6']); + unset($_POST['ContactName']); + unset($_POST['Telephone']); + unset($_POST['Fax']); + unset($_POST['Email']); + } + // But if errors were found in the input + + } else { + prnMsg(_('Validation failed') . _('no updates or deletes took place'), 'warn'); + } + /* If neither the Update or Insert buttons were pushed was it the delete button? */ } elseif (isset($_POST['delete']) AND $_POST['delete'] != '') { - - $CancelDelete = 0; - -// PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts - - $sql= "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='$FactorID'"; - $result = DB_query($sql, $db); - $myrow = DB_fetch_row($result); - if ($myrow[0] > 0) { - $CancelDelete = 1; - prnMsg(_('Cannot delete this factor because there are suppliers using them'),'warn'); - echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); - } - - if ($CancelDelete == 0) { - $sql="DELETE FROM factorcompanies WHERE id='$FactorID'"; - $result = DB_query($sql, $db); - prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'),'success'); - unset($FactorID); - unset($_SESSION['FactorID']); - } //end if Delete factor + $CancelDelete = 0; + // PREVENT DELETES IF DEPENDENT RECORDS IN 'SuppTrans' , PurchOrders, SupplierContacts + $sql = "SELECT COUNT(*) FROM suppliers WHERE factorcompanyid='$FactorID'"; + $result = DB_query($sql, $db); + $myrow = DB_fetch_row($result); + if ($myrow[0] > 0) { + $CancelDelete = 1; + prnMsg(_('Cannot delete this factor because there are suppliers using them'), 'warn'); + echo '<br>' . _('There are') . ' ' . $myrow[0] . ' ' . _('suppliers using this factor company'); + } + if ($CancelDelete == 0) { + $sql = "DELETE FROM factorcompanies WHERE id='$FactorID'"; + $result = DB_query($sql, $db); + prnMsg(_('Factoring company record record for') . ' ' . $_POST['FactorName'] . ' ' . _('has been deleted'), 'success'); + unset($FactorID); + unset($_SESSION['FactorID']); + } //end if Delete factor + } - /* So the page hasn't called itself with the input/update/delete/buttons */ - /* If it didn't come with a $FactorID it must be a completely fresh start, so choose a new $factorID or give the - option to create a new one*/ - -if (!isset($FactorID) or ($FactorID==1 and isset($_POST['amend']))) { - - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; - - echo "<input type='hidden' name='New' VALUE='No'>"; - - $result=DB_query('SELECT id, coyname FROM factorcompanies', $db); -// $myrow = DB_fetch_array($result); - echo '<table><tr><td>'; - echo "<select tabindex=1 name='FactorID'>"; - while ($myrow = DB_fetch_array($result)) { - echo '<option selected VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; +option to create a new one*/ +if (!isset($FactorID) or ($FactorID == 1 and isset($_POST['amend']))) { + echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; + echo "<input type='hidden' name='New' VALUE='No'>"; + $result = DB_query('SELECT id, coyname FROM factorcompanies', $db); + $NumberOfRows=DB_num_rows($result); + // $myrow = DB_fetch_array($result); + echo '<table><tr><td>'; + echo "<select tabindex=1 name='FactorID'>"; + while ($myrow = DB_fetch_array($result)) { + echo '<option selected VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; + } + echo "</select></td></tr></table><p><div class='centre'>"; + if ($NumberOfRows>0) { + echo "<input tabindex=2 type='Submit' name='amend' VALUE='" . _('Amend Factor') . "'>"; } - echo "</select></td></tr></table><p><div class='centre'><input TABINDEX=2 type='Submit' name='amend' VALUE='" . _('Amend Factor') . "'>"; - echo "<br><input TABINDEX=3 type='Submit' name='Create' VALUE='" . _('Create New Factor') . "'>"; - echo '</div></form>'; - + echo "<input tabindex=3 type='Submit' name='Create' VALUE='" . _('Create New Factor') . "'>"; + echo '</div></form>'; } else { - - echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; - echo '<table>'; - - if (isset($_POST['New']) and $_POST['New']=="No") { - - $sql = "SELECT id, + echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "?" . SID . "'>"; + echo '<table>'; + if (isset($_POST['New']) and $_POST['New'] == "No") { + $sql = "SELECT id, coyname, address1, address2, @@ -180,64 +151,55 @@ fax, email FROM factorcompanies - WHERE id = ".$FactorID; - - $result = DB_query($sql, $db); - $myrow = DB_fetch_array($result); - - $_POST['FactorName'] = $myrow['coyname']; - $_POST['Address1'] = $myrow['address1']; - $_POST['Address2'] = $myrow['address2']; - $_POST['Address3'] = $myrow['address3']; - $_POST['Address4'] = $myrow['address4']; - $_POST['Address5'] = $myrow['address5']; - $_POST['Address6'] = $myrow['address6']; - $_POST['ContactName'] = $myrow['contact']; - $_POST['Telephone'] = $myrow['telephone']; - $_POST['Fax'] = $myrow['fax']; - $_POST['Email'] = $myrow['email']; - - echo "<input type=hidden name='FactorID' VALUE='$FactorID'>"; - - } else { - // its a new factor being added - echo "<input type=hidden name='New' VALUE='Yes'>"; - echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE=0 size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' size=55 maxlength=55></td></tr>"; - echo '</form>'; - } - - - if (isset($_POST['New']) and $_POST['New']=="Yes") { - echo "</table><p><div class='centre'><input tabindex=12 type='Submit' name='submit' VALUE='" . _('Insert New Factor') . "'></div>"; - } else { - echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' VALUE='" . $_POST['FactorName'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' VALUE='" . $_POST['Address1'] . "' ' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' VALUE='" . $_POST['Address2'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' VALUE='" . $_POST['Address3'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' VALUE='" . $_POST['Address4'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' VALUE='" . $_POST['Address5'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' VALUE='" . $_POST['Address6'] . "' size=42 maxlength=40></td></tr>"; - echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' VALUE='" . $_POST['ContactName'] . "' size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' VALUE='" . $_POST['Telephone'] . "' size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE='" . $_POST['Fax'] . "' VALUE=0 size=13 maxlength=25></td></tr>"; - echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' VALUE='" . $_POST['Email'] . "' size=55 maxlength=55></td></tr>"; - echo '</form>'; - echo "<p></table><div class='centre'><input tabindex=13 type='Submit' name='submit' VALUE='" . _('Update Factor') . "'>"; - prnMsg ( _('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no suppliers are using this factor before the deletion is processed'), 'warn'); - echo "<input tabindex=14 type='Submit' name='delete' VALUE='" . _('Delete Factor') . "' onclick=\"return confirm('" . _('Are you sure you wish to delete this factoring company?') . "');\"></form></div>"; - } - + WHERE id = " . $FactorID; + $result = DB_query($sql, $db); + $myrow = DB_fetch_array($result); + $_POST['FactorName'] = $myrow['coyname']; + $_POST['Address1'] = $myrow['address1']; + $_POST['Address2'] = $myrow['address2']; + $_POST['Address3'] = $myrow['address3']; + $_POST['Address4'] = $myrow['address4']; + $_POST['Address5'] = $myrow['address5']; + $_POST['Address6'] = $myrow['address6']; + $_POST['ContactName'] = $myrow['contact']; + $_POST['Telephone'] = $myrow['telephone']; + $_POST['Fax'] = $myrow['fax']; + $_POST['Email'] = $myrow['email']; + echo "<input type=hidden name='FactorID' VALUE='$FactorID'>"; + } else { + // its a new factor being added + echo "<input type=hidden name='New' VALUE='Yes'>"; + echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' size=13 maxlength=25></td></tr>"; + echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' size=13 maxlength=25></td></tr>"; + echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE=0 size=13 maxlength=25></td></tr>"; + echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' size=55 maxlength=55></td></tr>"; + } + if (isset($_POST['New']) and $_POST['New'] == "Yes") { + echo "</table><p><div class='centre'><input tabindex=12 type='Submit' name='submit' VALUE='" . _('Insert New Factor') . "'></div>"; + } else { + echo '<tr><td>' . _('Factor company Name') . ":</td><td><input tabindex=1 type='text' name='FactorName' VALUE='" . $_POST['FactorName'] . "' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 1') . ":</td><td><input tabindex=2 type='text' name='Address1' VALUE='" . $_POST['Address1'] . "' ' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 2') . ":</td><td><input tabindex=3 type='text' name='Address2' VALUE='" . $_POST['Address2'] . "' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 3') . ":</td><td><input tabindex=4 type='text' name='Address3' VALUE='" . $_POST['Address3'] . "' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 4') . ":</td><td><input tabindex=5 type='text' name='Address4' VALUE='" . $_POST['Address4'] . "' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 5') . ":</td><td><input tabindex=6 type='text' name='Address5' VALUE='" . $_POST['Address5'] . "' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Address Line 6') . ":</td><td><input tabindex=7 type='text' name='Address6' VALUE='" . $_POST['Address6'] . "' size=42 maxlength=40></td></tr>"; + echo '<tr><td>' . _('Contact Name') . ":</td><td><input tabindex=8 type='text' name='ContactName' VALUE='" . $_POST['ContactName'] . "' size=13 maxlength=25></td></tr>"; + echo '<tr><td>' . _('Telephone') . ":</td><td><input tabindex=9 type='text' name='Telephone' VALUE='" . $_POST['Telephone'] . "' size=13 maxlength=25></td></tr>"; + echo '<tr><td>' . _('Fax') . ":</td><td><input tabindex=10 type='text' name='Fax' VALUE='" . $_POST['Fax'] . "' VALUE=0 size=13 maxlength=25></td></tr>"; + echo '<tr><td>' . _('Email') . ":</td><td><input tabindex=11 type='text' name='Email' VALUE='" . $_POST['Email'] . "' size=55 maxlength=55></td></tr>"; + echo "<p></table><div class='centre'><input tabindex=13 type='Submit' name='submit' VALUE='" . _('Update Factor') . "'>"; + prnMsg(_('There is no second warning if you hit the delete button below') . '. ' . _('However checks will be made to ensure there are no suppliers are using this factor before the deletion is processed'), 'warn'); + echo "<input tabindex=14 type='Submit' name='delete' VALUE='" . _('Delete Factor') . "' onclick=\"return confirm('" . _('Are you sure you wish to delete this factoring company?') . "');\"></form></div>"; + } + echo '</form>'; } // end of main ifs - -include('includes/footer.inc'); +include ('includes/footer.inc'); ?> \ No newline at end of file Modified: trunk/Suppliers.php =================================================================== --- trunk/Suppliers.php 2009-11-19 06:17:13 UTC (rev 3050) +++ trunk/Suppliers.php 2009-11-19 11:49:22 UTC (rev 3051) @@ -635,7 +635,7 @@ $result=DB_query('SELECT id, coyname FROM factorcompanies', $db); echo '<tr><td>' . _('Factor Company') . ":</td><td><select name='FactorID'>"; - + echo '<option VALUE=0>' . _('None'); while ($myrow = DB_fetch_array($result)) { if (isset($_POST['FactorID']) and $_POST['FactorID'] == $myrow['id']){ echo '<option selected VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; @@ -769,7 +769,7 @@ $result=DB_query('SELECT id, coyname FROM factorcompanies', $db); echo '<tr><td>' . _('Factor Company') . ":</td><td><select name='FactorID'>"; - + echo '<option VALUE=0>' . _('None'); while ($myrow = DB_fetch_array($result)) { if ($_POST['FactorID'] == $myrow['id']){ echo '<option selected VALUE=' . $myrow['id'] . '>' . $myrow['coyname']; Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-19 06:17:13 UTC (rev 3050) +++ trunk/doc/Change.log.html 2009-11-19 11:49:22 UTC (rev 3051) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>19/11/09 Tim: Improvements to factor company implementaton. <p>18/11/09 Tim: default.css - Correction to jelly theme <p>18/11/09 Tim: PO_Header.php - Add direct link to raise a Purchase Order <p>18/11/09 Tim: PO_PDFOrderPageHeader.inc - Include payment terms on the order. Modified: trunk/sql/mysql/upgrade3.11-3.12.sql =================================================================== --- trunk/sql/mysql/upgrade3.11-3.12.sql 2009-11-19 06:17:13 UTC (rev 3050) +++ trunk/sql/mysql/upgrade3.11-3.12.sql 2009-11-19 11:49:22 UTC (rev 3051) @@ -39,3 +39,7 @@ ALTER TABLE `purchorders` ADD COLUMN `supptel` varchar(30) NOT NULL DEFAULT '' AFTER suppliercontact; ALTER TABLE `purchorders` ADD COLUMN `tel` varchar(15) NOT NULL DEFAULT '' AFTER deladd6; ALTER TABLE `purchorders` ADD COLUMN `port` varchar(40) NOT NULL DEFAULT '' ; + +ALTER TABLE `suppliers` DROP FOREIGN KEY `suppliers_ibfk_4`; +UPDATE `suppliers` SET `factorcompanyid`=0 WHERE `factorcompanyid`=1; +DELETE FROM `factorcompanies` WHERE `coyname`='None'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-20 15:35:22
|
Revision: 3056 http://web-erp.svn.sourceforge.net/web-erp/?rev=3056&view=rev Author: tim_schofield Date: 2009-11-20 15:35:14 +0000 (Fri, 20 Nov 2009) Log Message: ----------- Create a log file of all status messages. Default is no log. Modified Paths: -------------- trunk/SystemParameters.php trunk/doc/Change.log.html trunk/includes/MiscFunctions.php trunk/sql/mysql/upgrade3.11-3.12.sql Modified: trunk/SystemParameters.php =================================================================== --- trunk/SystemParameters.php 2009-11-20 14:59:01 UTC (rev 3055) +++ trunk/SystemParameters.php 2009-11-20 15:35:14 UTC (rev 3056) @@ -243,6 +243,12 @@ if ($_SESSION['MonthsAuditTrail'] != $_POST['X_MonthsAuditTrail']){ $sql[] = 'UPDATE config SET confvalue=' . $_POST['X_MonthsAuditTrail'] . " WHERE confname='MonthsAuditTrail'"; } + if ($_SESSION['LogSeverity'] != $_POST['X_LogSeverity']){ + $sql[] = 'UPDATE config SET confvalue=' . $_POST['X_LogSeverity'] . " WHERE confname='LogSeverity'"; + } + if ($_SESSION['LogPath'] != $_POST['X_LogPath']){ + $sql[] = "UPDATE config SET confvalue='" . $_POST['X_LogPath'] . "' WHERE confname='LogPath'"; + } if ($_SESSION['UpdateCurrencyRatesDaily'] != $_POST['X_UpdateCurrencyRatesDaily']){ if ($_POST['X_UpdateCurrencyRatesDaily']=='Auto'){ $sql[] = "UPDATE config SET confvalue='" . Date('Y-m-d',mktime(0,0,0,Date('m'),Date('d')-1,Date('Y'))) . "' WHERE confname='UpdateCurrencyRatesDaily'"; @@ -250,7 +256,7 @@ $sql[] = "UPDATE config SET confvalue='0' WHERE confname='UpdateCurrencyRatesDaily'"; } } - if ($_SESSION['FactoryManagerEmail'] != $_POST['X_FactoryMangerEmail']){ + if ($_SESSION['FactoryManagerEmail'] != $_POST['X_FactoryManagerEmail']){ $sql[] = "UPDATE config SET confvalue='" . $_POST['X_FactoryManagerEmail'] . "' WHERE confname='FactoryManagerEmail'"; } if ($_SESSION['AutoCreateWOs'] != $_POST['X_AutoCreateWOs']){ @@ -633,7 +639,7 @@ $ErrMsg = _('Could not load the Number Of Month Must be Shown'); $result = DB_query($sql,$db,$ErrMsg); $row = DB_fetch_array($result); -$_SESSION['NumberOfMonthMustBeShown'] == $row['confvalue']; +$_SESSION['NumberOfMonthMustBeShown'] = $row['confvalue']; echo '<tr><td>' . _('Number Of Month Must Be Shown') . ':</td> <td><input type="text" class="number" name="X_NumberOfMonthMustBeShown" size=4 maxlength=3 value="' . $_SESSION['NumberOfMonthMustBeShown'] . '"></td> @@ -861,6 +867,47 @@ <td><input type="text" class="number" name="X_MonthsAuditTrail" size=3 maxlength=2 value="' . $_SESSION['MonthsAuditTrail'] . '"></td><td>' . _('If this parameter is set to 0 (zero) then no audit trail is retained. An audit trail is a log of which users performed which additions updates and deletes of database records. The full SQL is retained') . '</td> </tr>'; +//Which messages to log +echo '<tr><td>' . _('Log Severity Level') . ':</td><td><select name="X_LogSeverity" >'; +if ($_SESSION['LogSeverity']==0) { + echo '<option selected value=0>' ._('None'). '</option>'; + echo '<option value=1>' ._('Errors Only'). '</option>'; + echo '<option value=2>' ._('Errors and Warnings'). '</option>'; + echo '<option value=3>' ._('Errors, Warnings and Info'). '</option>'; + echo '<option value=4>' ._('All'). '</option>'; +} else if ($_SESSION['LogSeverity']==1) { + echo '<option value=0>' ._('None'). '</option>'; + echo '<option selected value=1>' ._('Errors Only'). '</option>'; + echo '<option value=2>' ._('Errors and Warnings'). '</option>'; + echo '<option value=3>' ._('Errors, Warnings and Info'). '</option>'; + echo '<option value=4>' ._('All'). '</option>'; +} else if ($_SESSION['LogSeverity']==2) { + echo '<option value=0>' ._('None'). '</option>'; + echo '<option value=1>' ._('Errors Only'). '</option>'; + echo '<option selected value=2>' ._('Errors and Warnings'). '</option>'; + echo '<option value=3>' ._('Errors, Warnings and Info'). '</option>'; + echo '<option value=4>' ._('All'). '</option>'; +} else if ($_SESSION['LogSeverity']==3) { + echo '<option value=0>' ._('None'). '</option>'; + echo '<option value=1>' ._('Errors Only'). '</option>'; + echo '<option value=2>' ._('Errors and Warnings'). '</option>'; + echo '<option selected value=3>' ._('Errors, Warnings and Info'). '</option>'; + echo '<option value=4>' ._('All'). '</option>'; +} else if ($_SESSION['LogSeverity']==4) { + echo '<option value=0>' ._('None'). '</option>'; + echo '<option value=1>' ._('Errors Only'). '</option>'; + echo '<option value=2>' ._('Errors andWarnings'). '</option>'; + echo '<option value=3>' ._('Errors, Warnings and Info'). '</option>'; + echo '<option selected value=4>' ._('All'). '</option>'; +} +echo '</select></td>'; +echo '<td>' . _('Choose which Status messages to keep in your log file.') . '</td></tr>'; + +//Path to keep log files in +echo '<tr><td>' . _('Path to log files') . ':</td> + <td><input type="text" name="X_LogPath" size=40 maxlength=79 value="' . $_SESSION['LogPath'] . '"></td><td>' . _('The path to the directory where the log files will be stored. Note the apache user must have write permissions on this directory.') . '</td> +</tr>'; + //DefineControlledOnWOEntry echo '<tr><td>' . _('Controlled Items Defined At Work Order Entry') . ':</td> <td><select Name="X_DefineControlledOnWOEntry"> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-20 14:59:01 UTC (rev 3055) +++ trunk/doc/Change.log.html 2009-11-20 15:35:14 UTC (rev 3056) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>20/11/09 Tim: Create a log file of all status messages. Default is no log. <p>19/11/09 Tim: Improvements to factor company implementaton. <p>18/11/09 Tim: default.css - Correction to jelly theme <p>18/11/09 Tim: PO_Header.php - Add direct link to raise a Purchase Order Modified: trunk/includes/MiscFunctions.php =================================================================== --- trunk/includes/MiscFunctions.php 2009-11-20 14:59:01 UTC (rev 3055) +++ trunk/includes/MiscFunctions.php 2009-11-20 15:35:14 UTC (rev 3056) @@ -13,23 +13,36 @@ function getMsg($Msg,$Type='info',$Prefix=''){ $Colour=''; + $LogFile=fopen($_SESSION['LogPath'].'/webERP-test.log', 'a'); switch($Type){ case 'error': $Class = 'error'; $Prefix = $Prefix ? $Prefix : _('ERROR') . ' ' ._('Message Report'); + if ($_SESSION['LogSeverity']>0) { + fwrite($LogFile, date('Y-m-d h-m-s').','.$Type.','.$_SESSION['UserID'].','.trim($Msg,',')."\n"); + } break; case 'warn': $Class = 'warn'; $Prefix = $Prefix ? $Prefix : _('WARNING') . ' ' . _('Message Report'); + if ($_SESSION['LogSeverity']>1) { + fwrite($LogFile, date('Y-m-d h-m-s').','.$Type.','.$_SESSION['UserID'].','.trim($Msg,',')."\n"); + } break; case 'success': $Class = 'success'; $Prefix = $Prefix ? $Prefix : _('SUCCESS') . ' ' . _('Report'); + if ($_SESSION['LogSeverity']>3) { + fwrite($LogFile, date('Y-m-d h-m-s').','.$Type.','.$_SESSION['UserID'].','.trim($Msg,',')."\n"); + } break; case 'info': default: $Prefix = $Prefix ? $Prefix : _('INFORMATION') . ' ' ._('Message'); $Class = 'info'; + if ($_SESSION['LogSeverity']>2) { + fwrite($LogFile, date('Y-m-d h-m-s').','.$Type.','.$_SESSION['UserID'].','.trim($Msg,',')."\n"); + } } return '<DIV class="'.$Class.'"><B>' . $Prefix . '</B> : ' .$Msg . '</DIV>'; }//getMsg Modified: trunk/sql/mysql/upgrade3.11-3.12.sql =================================================================== --- trunk/sql/mysql/upgrade3.11-3.12.sql 2009-11-20 14:59:01 UTC (rev 3055) +++ trunk/sql/mysql/upgrade3.11-3.12.sql 2009-11-20 15:35:14 UTC (rev 3056) @@ -42,4 +42,7 @@ ALTER TABLE `suppliers` DROP FOREIGN KEY `suppliers_ibfk_4`; UPDATE `suppliers` SET `factorcompanyid`=0 WHERE `factorcompanyid`=1; -DELETE FROM `factorcompanies` WHERE `coyname`='None'; \ No newline at end of file +DELETE FROM `factorcompanies` WHERE `coyname`='None'; + +INSERT INTO `config` (`confname`, `confvalue`) VALUES ('LogPath', ''); +INSERT INTO `config` (`confname`, `confvalue`) VALUES ('LogSeverity', '0'); \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-20 16:50:34
|
Revision: 3057 http://web-erp.svn.sourceforge.net/web-erp/?rev=3057&view=rev Author: tim_schofield Date: 2009-11-20 16:50:26 +0000 (Fri, 20 Nov 2009) Log Message: ----------- Correction of errors in retrieving the number of months inquiries to show. Modified Paths: -------------- trunk/CustomerInquiry.php trunk/doc/Change.log.html Modified: trunk/CustomerInquiry.php =================================================================== --- trunk/CustomerInquiry.php 2009-11-20 15:35:14 UTC (rev 3056) +++ trunk/CustomerInquiry.php 2009-11-20 16:50:26 UTC (rev 3057) @@ -27,7 +27,8 @@ if (!isset($_POST['TransAfterDate'])) { $sql = 'SELECT confvalue FROM `config` - WHERE confname ="numberOfMonthMustBeShown"'; + WHERE confname ="NumberOfMonthMustBeShown"'; + $ErrMsg=_('The config value NumberOfMonthMustBeShown cannot be retrieved'); $result = DB_query($sql,$db,$ErrMsg); $row = DB_fetch_array($result); $_POST['TransAfterDate'] = Date($_SESSION['DefaultDateFormat'],Mktime(0,0,0,Date('m')-$row['confvalue'],Date('d'),Date('Y'))); Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-20 15:35:14 UTC (rev 3056) +++ trunk/doc/Change.log.html 2009-11-20 16:50:26 UTC (rev 3057) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>20/11/09 Tim: CustomerInquiry.php - Correction of errors in retrieving the number of months inquiries to show. <p>20/11/09 Tim: Create a log file of all status messages. Default is no log. <p>19/11/09 Tim: Improvements to factor company implementaton. <p>18/11/09 Tim: default.css - Correction to jelly theme This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-21 10:24:44
|
Revision: 3067 http://web-erp.svn.sourceforge.net/web-erp/?rev=3067&view=rev Author: tim_schofield Date: 2009-11-21 10:24:36 +0000 (Sat, 21 Nov 2009) Log Message: ----------- Take out reference to $demo_text and the incorrect call to session_start(). Modified Paths: -------------- trunk/Logout.php trunk/doc/Change.log.html Modified: trunk/Logout.php =================================================================== --- trunk/Logout.php 2009-11-21 06:52:36 UTC (rev 3066) +++ trunk/Logout.php 2009-11-21 10:24:36 UTC (rev 3067) @@ -20,7 +20,6 @@ <form action=" <?php echo $rootpath;?>/index.php" name="loginform" method="post"> <label><?php echo _('Thank you for using webERP'); ?></label> <br /> - <div id="demo_text"><?php echo $demo_text;?></div> <input class="button" type="submit" value="<?php echo _('Login'); ?>" name="SubmitUser" /> </form> </div> @@ -31,7 +30,6 @@ <?php // Cleanup - session_start(); session_unset(); session_destroy(); ?> Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-21 06:52:36 UTC (rev 3066) +++ trunk/doc/Change.log.html 2009-11-21 10:24:36 UTC (rev 3067) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>21/11/09 Tim: Logout.php - Take out reference to $demo_text and the incorrect call to session_start(). <p>20/11/09 Tim: CustomerInquiry.php - Correction of errors in retrieving the number of months inquiries to show. <p>20/11/09 Tim: Create a log file of all status messages. Default is no log. <p>19/11/09 Tim: Improvements to factor company implementaton. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-21 12:09:07
|
Revision: 3068 http://web-erp.svn.sourceforge.net/web-erp/?rev=3068&view=rev Author: tim_schofield Date: 2009-11-21 12:08:59 +0000 (Sat, 21 Nov 2009) Log Message: ----------- Correct edit functionality - Fixes Ticket #15 Modified Paths: -------------- trunk/PO_AuthorisationLevels.php trunk/doc/Change.log.html Modified: trunk/PO_AuthorisationLevels.php =================================================================== --- trunk/PO_AuthorisationLevels.php 2009-11-21 10:24:36 UTC (rev 3067) +++ trunk/PO_AuthorisationLevels.php 2009-11-21 12:08:59 UTC (rev 3068) @@ -109,29 +109,42 @@ echo "<form action='" . $_SERVER['PHP_SELF'] . '?' . SID . "' method=post name='form1'>"; echo '<table>'; -echo '<tr><td>'._('User ID').'</td><td><select name=userid>'; -$usersql='SELECT userid FROM www_users'; -$userresult=DB_query($usersql,$db); -while ($myrow=DB_fetch_array($userresult)) { - if ($myrow['userid']==$UserID) { - echo '<option selected value="'.$myrow['userid'].'">'.$myrow['userid'].'</option>'; - } else { - echo '<option value="'.$myrow['userid'].'">'.$myrow['userid'].'</option>'; +if (isset($_GET['Edit'])) { + echo '<tr><td>'._('User ID').'</td><td>'.$UserID.'</td></tr>'; + echo '<input type=hidden name=userid value="'.$UserID.'"'; +} else { + echo '<tr><td>'._('User ID').'</td><td><select name=userid>'; + $usersql='SELECT userid FROM www_users'; + $userresult=DB_query($usersql,$db); + while ($myrow=DB_fetch_array($userresult)) { + if ($myrow['userid']==$UserID) { + echo '<option selected value="'.$myrow['userid'].'">'.$myrow['userid'].'</option>'; + } else { + echo '<option value="'.$myrow['userid'].'">'.$myrow['userid'].'</option>'; + } } + echo '</select></td></tr>'; } -echo '</select></td></tr>'; -echo '<tr><td>'._('Currency').'</td><td><select name=currabrev>'; -$currencysql='SELECT currabrev,currency FROM currencies'; -$currencyresult=DB_query($currencysql,$db); -while ($myrow=DB_fetch_array($currencyresult)) { - if ($myrow['currabrev']==$Currency) { - echo '<option selected value="'.$myrow['currabrev'].'">'.$myrow['currency'].'</option>'; - } else { - echo '<option value="'.$myrow['currabrev'].'">'.$myrow['currency'].'</option>'; +if (isset($_GET['Edit'])) { + $currencysql='SELECT currency FROM currencies WHERE currabrev="'.$Currency.'"'; + $currencyresult=DB_query($currencysql,$db); + $myrow=DB_fetch_array($currencyresult); + echo '<tr><td>'._('Currency').'</td><td>'.$myrow['currency'].'</td></tr>'; + echo '<input type=hidden name=currabrev value="'.$Currency.'"'; +} else { + echo '<tr><td>'._('Currency').'</td><td><select name=currabrev>'; + $currencysql='SELECT currabrev,currency FROM currencies'; + $currencyresult=DB_query($currencysql,$db); + while ($myrow=DB_fetch_array($currencyresult)) { + if ($myrow['currabrev']==$Currency) { + echo '<option selected value="'.$myrow['currabrev'].'">'.$myrow['currency'].'</option>'; + } else { + echo '<option value="'.$myrow['currabrev'].'">'.$myrow['currency'].'</option>'; + } } + echo '</select></td></tr>'; } -echo '</select></td></tr>'; echo '<tr><td>'._('User can create orders').'</td>'; if ($CanCreate==1) { Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-21 10:24:36 UTC (rev 3067) +++ trunk/doc/Change.log.html 2009-11-21 12:08:59 UTC (rev 3068) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>21/11/09 Tim: PO_AuthorisationLevels.php - Correct edit functionality - Fixes Ticket #15 <p>21/11/09 Tim: Logout.php - Take out reference to $demo_text and the incorrect call to session_start(). <p>20/11/09 Tim: CustomerInquiry.php - Correction of errors in retrieving the number of months inquiries to show. <p>20/11/09 Tim: Create a log file of all status messages. Default is no log. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tim...@us...> - 2009-11-22 11:30:34
|
Revision: 3077 http://web-erp.svn.sourceforge.net/web-erp/?rev=3077&view=rev Author: tim_schofield Date: 2009-11-22 11:30:25 +0000 (Sun, 22 Nov 2009) Log Message: ----------- Correct variable name to show order lines correctly Modified Paths: -------------- trunk/PO_PDFPurchOrder.php trunk/doc/Change.log.html trunk/includes/PO_PDFOrderPageHeader.inc Modified: trunk/PO_PDFPurchOrder.php =================================================================== --- trunk/PO_PDFPurchOrder.php 2009-11-22 10:41:36 UTC (rev 3076) +++ trunk/PO_PDFPurchOrder.php 2009-11-22 11:30:25 UTC (rev 3077) @@ -90,7 +90,7 @@ suppliers.currcode FROM purchorders INNER JOIN suppliers ON purchorders.supplierno = suppliers.supplierid - WHERE purchorders.orderno = " . $OrderNo; + WHERE purchorders.orderno=" . $OrderNo; $result=DB_query($sql,$db, $ErrMsg); if (DB_num_rows($result)==0){ /*There is ony one order header returned */ Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2009-11-22 10:41:36 UTC (rev 3076) +++ trunk/doc/Change.log.html 2009-11-22 11:30:25 UTC (rev 3077) @@ -1,5 +1,6 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p> +<p>22/11/09 Tim: PO_PDFOrderPageHeader.php - Correct variable name to show order lines correctly <p>21/11/09 Tim: PO_AuthorisationLevels.php - Correct edit functionality - Fixes Ticket #15 <p>21/11/09 Tim: Logout.php - Take out reference to $demo_text and the incorrect call to session_start(). <p>20/11/09 Tim: CustomerInquiry.php - Correction of errors in retrieving the number of months inquiries to show. Modified: trunk/includes/PO_PDFOrderPageHeader.inc =================================================================== --- trunk/includes/PO_PDFOrderPageHeader.inc 2009-11-22 10:41:36 UTC (rev 3076) +++ trunk/includes/PO_PDFOrderPageHeader.inc 2009-11-22 11:30:25 UTC (rev 3077) @@ -124,8 +124,8 @@ } $sql='SELECT terms FROM paymentterms where termsindicator="'.$POHeader['paymentterms'].'"'; -$result=DB_query($sql, $db); -$myrow=DB_fetch_array($result); +$termsresult=DB_query($sql, $db); +$myrow=DB_fetch_array($termsresult); $pdf->addText($XPos+2,$YPos-($line_height), $FontSize, _('Payment Terms').' : '.$myrow['terms']); $XPos = $Left_Margin; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |