From: <dai...@us...> - 2011-01-23 04:09:00
|
Revision: 4473 http://web-erp.svn.sourceforge.net/web-erp/?rev=4473&view=rev Author: daintree Date: 2011-01-23 04:08:53 +0000 (Sun, 23 Jan 2011) Log Message: ----------- Depreciation period fixes Modified Paths: -------------- trunk/CounterSales.php trunk/FixedAssetDepreciation.php trunk/FixedAssetItems.php trunk/FixedAssetRegister.php trunk/MRPDemands.php trunk/MRPPlannedPurchaseOrders.php trunk/MRPPlannedWorkOrders.php trunk/PricesBasedOnMarkUp.php trunk/SupplierInvoice.php trunk/UpgradeDatabase.php trunk/doc/Change.log.html trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc trunk/includes/DateFunctions.inc trunk/index.php trunk/sql/mysql/upgrade3.11.1-4.00.sql Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/CounterSales.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -713,7 +713,7 @@ <td><input class="number" type="text" name="GPPercent_' . $OrderLine->LineNumber . '" size="3" maxlength="40" value="' . $OrderLine->GPPercent . '" /></td>'; echo '<td class="number">' . number_format($SubTotal,2) . '</td>'; $LineDueDate = $OrderLine->ItemDue; - if (!is_Date($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; } Modified: trunk/FixedAssetDepreciation.php =================================================================== --- trunk/FixedAssetDepreciation.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/FixedAssetDepreciation.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -26,16 +26,22 @@ $AllowUserEnteredProcessDate = true; -if ($LastDepnRun[1]==0 AND $LastDepnRun[0]==NULL) { //then depn has never been run yet? - +if (DB_num_rows($result)==0) { //then depn has never been run yet? /*in this case default depreciation calc to the last day of last month - and allow user to select a period */ if (!isset($_POST['ProcessDate'])) { $_POST['ProcessDate'] = Date($_SESSION['DefaultDateFormat'],mktime(0,0,0,date('m'),0,date('Y'))); + } else { //ProcessDate is set - make sure it is on the last day of the month selected + if (!Is_Date($_POST['ProcessDate'])){ + prnMsg(_('The date is expected to be in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'error'); + $InputError =true; + }else { + $_POST['ProcessDate'] = LastDayOfMonth($_POST['ProcessDate']); + } } } else { //depn calc has been run previously $AllowUserEnteredProcessDate = false; - $_POST['ProcessDate'] = DateAdd(ConvertSQLDate($LastDepnRun[0]),'m',1); + $_POST['ProcessDate'] = LastDayOfMonth(DateAdd(ConvertSQLDate($LastDepnRun[0]),'d',28)); } @@ -204,7 +210,7 @@ periodno, inputdate, fixedassettranstype, - depn) + amount) VALUES ('" . $AssetRow['assetid'] . "', '44', '" . $TransNo . "', @@ -254,11 +260,14 @@ echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />'; echo '<p></p>'; echo '<table class=selection width=30%><tr></tr><tr>'; - if (AllowUserEnteredProcessDate){ + if ($AllowUserEnteredProcessDate){ echo '<td>'._('Date to Process Depreciation'). ':</td> <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat']. '" name="ProcessDate" maxlength=10 size=11 value="' . $_POST['ProcessDate'] . '"></td>'; + } else { + echo '<td>'._('Date to Process Depreciation'). ':</td> + <td>' . $_POST['ProcessDate'] .'</td>'; } - echo '<td><input type="submit" name="CommitDepreciation" value="'._('Commit Depreciation').'">'; + echo '<td><div class="centre"><input type="submit" name="CommitDepreciation" value="'._('Commit Depreciation').'"></div>'; echo '</tr></table><br>'; echo '</form>'; } Modified: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/FixedAssetItems.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -153,12 +153,12 @@ //debit cost for the new category $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount) "; + typeno, + trandate, + periodno, + account, + narrative, + amount) "; $SQL= $SQL . "VALUES (42, '" . $TransNo . "', '" . Date('Y-m-d') . "', @@ -230,8 +230,7 @@ prnMsg( _('Asset') . ' ' . $AssetID . ' ' . _('has been updated'), 'success'); echo '<br>'; } else { //it is a NEW part - $sql = "INSERT INTO fixedassets ( - description, + $sql = "INSERT INTO fixedassets (description, longdescription, assetcategoryid, assetlocation, @@ -247,8 +246,7 @@ '" . $_POST['DepnType'] . "', '" . $_POST['DepnRate']. "', '" . $_POST['BarCode'] . "', - '" . $_POST['SerialNo'] . "' - )"; + '" . $_POST['SerialNo'] . "' )"; $ErrMsg = _('The asset could not be added because'); $DbgMsg = _('The SQL that was used to add the asset failed was'); $result = DB_query($sql,$db, $ErrMsg, $DbgMsg); @@ -349,7 +347,6 @@ } //end if cost > 0 - $sql="DELETE FROM fixedassets WHERE assetid='" . $AssetID . "'"; $result=DB_query($sql,$db, _('Could not delete the asset record'),'',true); @@ -444,10 +441,9 @@ } 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"; -if ($New == 0) { //ie not new at all! - // Add image upload for New Item - by Ori +if (!isset($New) ) { //ie not new at all! + echo '<tr><td>'. _('Image File (.jpg)') . ':</td><td><input type="file" id="ItemPicture" name="ItemPicture"></td>'; - // EOR Add Image upload for New Item - by Ori if (function_exists('imagecreatefromjpg')){ $StockImgLink = '<img src="GetStockImage.php?SID&automake=1&textcolor=FFFFFF&bgcolor=CCCCCC'. @@ -553,7 +549,7 @@ </table>'; -if ($New==1) { +if (isset($New)) { echo '<div class=centre><br><input type="Submit" name="submit" value="' . _('Insert New Fixed Asset') . '">'; } else { Modified: trunk/FixedAssetRegister.php =================================================================== --- trunk/FixedAssetRegister.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/FixedAssetRegister.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -125,7 +125,7 @@ $AccumDepnCfwd = 0; } else { $CostCfwd = $myrow['periodadditions'] + $myrow['costbfwd']; - $AccumDepnCfwd = $myrow['periodepn'] + $myrow['depnbfwd']; + $AccumDepnCfwd = $myrow['perioddepn'] + $myrow['depnbfwd']; } if (isset($_POST['pdf'])) { @@ -165,12 +165,14 @@ echo '<td style="vertical-align:top">' . $myrow['longdescription'] . '</td>'; echo '<td style="vertical-align:top">' . $myrow['serialno'] . '</td>'; echo '<td>' . $myrow['locationdescription'] . '<br>'; - for ($i = 1;$i < sizeOf($Ancestors) - 1;$i++) { + /* Not reworked yet + * for ($i = 1;$i < sizeOf($Ancestors) - 1;$i++) { for ($j = 0;$j < $i;$j++) { echo ' '; } echo '|_' . $Ancestors[$i] . '<br>'; } + */ echo '</td><td style="vertical-align:top">' . ConvertSQLDate($myrow['datepurchased']) . '</td>'; echo '<td style="vertical-align:top" class="number">' . number_format($myrow['costbfwd'], 2) . '</td>'; echo '<td style="vertical-align:top" class="number">' . number_format($myrow['depnbfwd'], 2) . '</td>'; @@ -304,11 +306,12 @@ $Page_Height, $Page_Width, $Top_Margin, + $Bottom_Margin, $FontSize, $Left_Margin, $Right_Margin, - $line_height; - $AssetDescription; + $line_height, + $AssetDescription, $AssetCategory; if ($PageNumber>1){ Modified: trunk/MRPDemands.php =================================================================== --- trunk/MRPDemands.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/MRPDemands.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -144,7 +144,7 @@ $InputError = 1; prnMsg(_('Quantity must be greater than 0'),'error'); } - if (!is_Date($_POST['Duedate'])) { + if (!Is_Date($_POST['Duedate'])) { $InputError = 1; prnMsg(_('Invalid due date'),'error'); } Modified: trunk/MRPPlannedPurchaseOrders.php =================================================================== --- trunk/MRPPlannedPurchaseOrders.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/MRPPlannedPurchaseOrders.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -28,7 +28,7 @@ $Xpos = $Left_Margin+1; $wheredate = " "; $reportdate = " "; - if (is_Date($_POST['cutoffdate'])) { + if (Is_Date($_POST['cutoffdate'])) { $formatdate = FormatDateForSQL($_POST['cutoffdate']); $wheredate = ' AND duedate <= "' . $formatdate . '" '; $reportdate = _(' Through ') . Format_Date($_POST['cutoffdate']); @@ -165,7 +165,7 @@ // Get and print supplier info for part list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($db,$holdpart); $displaydate = $lastdate; - if (!is_Date($lastdate)) { + if (!Is_Date($lastdate)) { $displaydate = " "; } $YPos -= $line_height; @@ -228,7 +228,7 @@ // Get and print supplier info for part list($lastdate,$lastsupplier,$preferredsupplier) = GetPartInfo($db,$holdpart); $displaydate = $lastdate; - if (!is_Date($lastdate)) { + if (!Is_Date($lastdate)) { $displaydate = " "; } $YPos -= $line_height; Modified: trunk/MRPPlannedWorkOrders.php =================================================================== --- trunk/MRPPlannedWorkOrders.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/MRPPlannedWorkOrders.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -20,7 +20,7 @@ $wheredate = " "; $reportdate = " "; - if (is_Date($_POST['cutoffdate'])) { + if (Is_Date($_POST['cutoffdate'])) { $formatdate = FormatDateForSQL($_POST['cutoffdate']); $wheredate = ' AND duedate <= "' . $formatdate . '" '; $reportdate = _(' Through ') . $_POST['cutoffdate']; Modified: trunk/PricesBasedOnMarkUp.php =================================================================== --- trunk/PricesBasedOnMarkUp.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/PricesBasedOnMarkUp.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -200,7 +200,7 @@ $InputError =1; } if ($_POST['CostType']=='OtherPriceList' AND $_POST['BasePriceList']=='0'){ - echo '<br />Base price list selected: ' .$_POST['BasePriceList']; + echo '<br />' . _('Base price list selected') . ': ' .$_POST['BasePriceList']; prnMsg(_('When you are updating prices based on another price list - the other price list must also be selected. No updates will take place until the other price list is selected'),'error'); $InputError =1; } Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/SupplierInvoice.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -270,7 +270,8 @@ } echo ' <input type="submit" name="FixedAssets" VALUE="' . _('Fixed Assets') . '"></div>'; - + $TotalGRNValue = 0; + if (count( $_SESSION['SuppTrans']->GRNs)>0){ /*if there are any GRNs selected for invoicing then */ /*Show all the selected GRNs so far from the SESSION['SuppInv']->GRNs array */ @@ -284,8 +285,6 @@ <th>' . _('Line Total') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th></tr>'; echo $tableheader; - $TotalGRNValue = 0; - foreach ($_SESSION['SuppTrans']->GRNs as $EnteredGRN){ echo '<tr><td>' . $EnteredGRN->GRNNo . '</td><td>' . $EnteredGRN->ItemCode . @@ -304,6 +303,8 @@ echo '</table>'; } + $TotalShiptValue = 0; + if (count( $_SESSION['SuppTrans']->Shipts) > 0){ /*if there are any Shipment charges on the invoice*/ echo '<br /><table cellpadding=2 class=selection> @@ -312,7 +313,7 @@ <th>" . _('Amount') . '</th></tr>'; echo $TableHeader; - $TotalShiptValue = 0; + foreach ($_SESSION['SuppTrans']->Shipts as $EnteredShiptRef){ @@ -332,6 +333,7 @@ <td class=number><font size=4 color=BLUE><U>' . number_format($TotalShiptValue,2) . '</U></font></td></tr></table>'; } + $TotalAssetValue = 0; if (count( $_SESSION['SuppTrans']->Assets) > 0){ /*if there are any fixed assets on the invoice*/ @@ -342,8 +344,6 @@ <th>' . _('Amount') . ' ' . $_SESSION['SuppTrans']->CurrCode . '</th></tr>'; echo $TableHeader; - $TotalAssetValue = 0; - foreach ($_SESSION['SuppTrans']->Assets as $EnteredAsset){ echo '<tr><td>' . $EnteredAsset->AssetID . '</td> @@ -363,8 +363,8 @@ <td class=number><font size=4 color=BLUE><U>' . number_format($TotalAssetValue,2) . '</U></font></td></tr></table>'; } //end loop around assets added to invocie + $TotalContractsValue = 0; - if (count( $_SESSION['SuppTrans']->Contracts) > 0){ /*if there are any contract charges on the invoice*/ echo '<br /><table cellpadding="2" class=selection> @@ -374,7 +374,7 @@ <th>' . _('Narrative') . '</th></tr>'; echo $TableHeader; - $TotalContractsValue = 0; + $i=0; foreach ($_SESSION['SuppTrans']->Contracts as $Contract){ @@ -397,7 +397,8 @@ </tr></table>'; } - + $TotalGLValue = 0; + if ( $_SESSION['SuppTrans']->GLLink_Creditors == 1){ if (count($_SESSION['SuppTrans']->GLCodes) > 0){ @@ -409,8 +410,6 @@ <th>' . _('Narrative') . '</th></tr>'; echo $TableHeader; - $TotalGLValue = 0; - foreach ($_SESSION['SuppTrans']->GLCodes as $EnteredGLCode){ echo '<tr><td>' . $EnteredGLCode->GLCode . '</td> @@ -427,21 +426,6 @@ </tr></table>'; } - if (!isset($TotalGRNValue)){ - $TotalGRNValue = 0; - } - if (!isset($TotalGLValue)){ - $TotalGLValue = 0; - } - if (!isset($TotalShiptValue)){ - $TotalShiptValue = 0; - } - if (!isset($TotalContractsValue)){ - $TotalContractsValue = 0; - } - if (!isset($TotalAssetValue)){ - $TotalAssetValue = 0; - } $_SESSION['SuppTrans']->OvAmount = ($TotalGRNValue + $TotalGLValue + $TotalAssetValue + $TotalShiptValue + $TotalContractsValue); echo '<br /><table class=selection><tr><td>' . _('Amount in supplier currency') . ':</td><td colspan=2 class=number>' . @@ -500,7 +484,7 @@ } else { /*Tax being entered manually accept the taxamount entered as is*/ // if (!isset($_POST['TaxAmount' . $Tax->TaxCalculationOrder])) { // $_POST['TaxAmount' . $Tax->TaxCalculationOrder]=0; -// } +// } $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxOvAmount = $_POST['TaxAmount' . $Tax->TaxCalculationOrder]; echo ' <input type="hidden" name="TaxRate"' . $Tax->TaxCalculationOrder . ' value="' . $_SESSION['SuppTrans']->Taxes[$Tax->TaxCalculationOrder]->TaxRate * 100 . '">'; @@ -554,33 +538,43 @@ $InputError = False; if ( $TaxTotal + $_SESSION['SuppTrans']->OvAmount < 0){ + $InputError = True; prnMsg(_('The invoice as entered cannot be processed because the total amount of the invoice is less than 0') . '. ' . _('Invoices are expected to have a positive charge'),'error'); echo '<p> The tax total is : ' . $TaxTotal; echo '<p> The ovamount is : ' . $_SESSION['SuppTrans']->OvAmount; + } elseif ( $TaxTotal + $_SESSION['SuppTrans']->OvAmount == 0){ + prnMsg(_('The invoice as entered will be processed but be warned the amount of the invoice is zero!') . '. ' . _('Invoices are normally expected to have a positive charge'),'warn'); + } elseif (strlen( $_SESSION['SuppTrans']->SuppReference)<1){ + $InputError = True; prnMsg(_('The invoice as entered cannot be processed because the there is no suppliers invoice number or reference entered') . '. ' . _('The supplier invoice number must be entered'),'error'); } elseif (!is_date( $_SESSION['SuppTrans']->TranDate)){ + $InputError = True; prnMsg( _('The invoice as entered cannot be processed because the invoice date entered is not in the format') . ' ' . $_SESSION['DefaultDateFormat'],'error'); - } elseif (DateDiff(Date($_SESSION['DefaultDateFormat']), $_SESSION['SuppTrans']->TranDate, "d") < 0){ + } elseif (DateDiff(Date($_SESSION['DefaultDateFormat']), $_SESSION['SuppTrans']->TranDate, 'd') < 0){ + $InputError = True; prnMsg(_('The invoice as entered cannot be processed because the invoice date is after today') . '. ' . _('Purchase invoices are expected to have a date prior to or today'),'error'); }elseif ( $_SESSION['SuppTrans']->ExRate <= 0){ + $InputError = True; prnMsg( _('The invoice as entered cannot be processed because the exchange rate for the invoice has been entered as a negative or zero number') . '. ' . _('The exchange rate is expected to show how many of the suppliers currency there are in 1 of the local currency'),'error'); - - }elseif ( $_SESSION['SuppTrans']->OvAmount < round($TotalShiptValue + $TotalGLValue + $TotalContractsValue+ $TotalAssetValue+$TotalGRNValue,2)){ + + } elseif ( $_SESSION['SuppTrans']->OvAmount < round($TotalShiptValue + $TotalGLValue + $TotalContractsValue+ $TotalAssetValue+$TotalGRNValue,2)){ + prnMsg( _('The invoice total as entered is less than the sum of the shipment charges, the general ledger entries (if any), the charges for goods received, contract charges and fixed asset charges. There must be a mistake somewhere, the invoice as entered will not be processed'),'error'); $InputError = True; } else { + $sql = "SELECT count(*) FROM supptrans WHERE supplierno='" . $_SESSION['SuppTrans']->SupplierID . "' Modified: trunk/UpgradeDatabase.php =================================================================== --- trunk/UpgradeDatabase.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/UpgradeDatabase.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -104,7 +104,7 @@ } $result = DB_IgnoreForeignKeys($db); - + foreach ($SQLScripts AS $SQLScriptFile) { $SQLEntries = file($SQLScriptFile); @@ -135,7 +135,7 @@ } if (strpos($SQLEntries[$i],';')>0 AND ! $InAFunction){ $sql = substr($sql,0,strlen($sql)-1); - $result = DB_query($sql, $db, $ErrMsg, $DBMsg, false, false); + $result = DB_query($sql, $db, '','', false, false); echo '<tr><td>' . $sql . '</td>'; switch (DB_error_no($db)) { case 0: Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/doc/Change.log.html 2011-01-23 04:08:53 UTC (rev 4473) @@ -1,5 +1,7 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>23/1/11: phil Fix Depreciation posting and dates of end of periods</p> +<p>23/1/11:Phil changed back references throughout several MRP scripts from is_date to Is_Date - as Is_Date is used throughout the code and much bigger job to change all references to is_date</p> <p>20/1/11: Tim changed back addinfo calls to addInfo on PDF reports - Zhigio originally thought to be an issue with Turkish utf-8 pdfs but turned out to be a red herring. class.pdf call changed back to addInfo too - most of calls had not been changed to lower case info</p> <p>20/1/11: Tim changed PricesBasedOnMarkUp to have end date day before new prices effective from</p> <p>20/1/11: Phil FixedAssetRegister.php FixedAssetDepreciation.php fixes </p> Modified: trunk/includes/ConnectDB_mysql.inc =================================================================== --- trunk/includes/ConnectDB_mysql.inc 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/includes/ConnectDB_mysql.inc 2011-01-23 04:08:53 UTC (rev 4473) @@ -5,6 +5,9 @@ define ('LIKE','LIKE'); global $db; // Make sure it IS global, regardless of our context +if (!isset($mysqlport)){ + $mysqlport = 3306; +} $db = mysql_connect($host.':'.$mysqlport , $dbuser, $dbpassword); //printf("tried making mysql Connection.\n"); Modified: trunk/includes/ConnectDB_mysqli.inc =================================================================== --- trunk/includes/ConnectDB_mysqli.inc 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/includes/ConnectDB_mysqli.inc 2011-01-23 04:08:53 UTC (rev 4473) @@ -9,6 +9,9 @@ define ('LIKE','LIKE'); +if (!isset($mysqlport)){ + $mysqlport = 3306; +} global $db; // Make sure it IS global, regardless of our context $db = mysqli_connect($host , $dbuser, $dbpassword,$_SESSION['DatabaseName'], $mysqlport); Modified: trunk/includes/DateFunctions.inc =================================================================== --- trunk/includes/DateFunctions.inc 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/includes/DateFunctions.inc 2011-01-23 04:08:53 UTC (rev 4473) @@ -15,7 +15,7 @@ */ -function is_date($DateEntry) { +function Is_date($DateEntry) { $DateEntry =Trim($DateEntry); @@ -41,7 +41,6 @@ return 0; } - if ((int)$Date_Array[2] >9999) { return 0; } @@ -79,7 +78,6 @@ } //end of Is_Date function - //_______________________________________________________________ function MonthAndYearFromSQLDate($DateEntry) { @@ -338,7 +336,7 @@ if ((int)$Date_Array[2] <60) { $Date_Array[2] = '20'.$Date_Array[2]; - } elseif ((int)$Date_Array[2] >59 AND (int)$Date_Array[2] <100) { + } elseif ((int)$Date_Array[2] >59 AND (int)$Date_Array[2] <100){ $Date_Array[2] = '19'.$Date_Array[2]; } elseif ((int)$Date_Array[2] >9999) { return 0; @@ -354,11 +352,11 @@ return $Date_Array[0].'.'.$Date_Array[1].'.'.$Date_Array[2]; } } elseif ($_SESSION['DefaultDateFormat']='m/d/Y'){ - if (checkdate((int)$Date_Array[0],(int)$Date_Array[1],(int)$Date_Array[2])) { + if (checkdate((int)$Date_Array[0],(int)$Date_Array[1],(int)$Date_Array[2])){ return $Date_Array[0].'/'.$Date_Array[1].'/'.$Date_Array[2]; } } elseif ($_SESSION['DefaultDateFormat']='Y/m/d'){ - if (checkdate((int)$Date_Array[2],(int)$Date_Array[0],(int)$Date_Array[1])) { + if (checkdate((int)$Date_Array[2],(int)$Date_Array[0],(int)$Date_Array[1])){ return $Date_Array[0].'/'.$Date_Array[1].'/'.$Date_Array[2]; } } // end if check date @@ -367,9 +365,6 @@ } }// end of function - - - function FormatDateForSQL($DateEntry) { /* takes a date in a the format specified in $_SESSION['DefaultDateFormat'] @@ -434,7 +429,70 @@ return FormatDateForSQL( $dt[0] ) . ' ' . $dt[1]; } +function LastDayOfMonth ( $DateEntry) { + /*Expects a date in DefaultDateFormat and + * Returns the last day of the month in the entered date + * in the DefaultDateFormat + * + * mktime (0,0,0 month, day, year) + */ + + $DateEntry = trim($DateEntry); + if (strpos($DateEntry,'/')) { + $Date_Array = explode('/',$DateEntry); + } elseif (strpos ($DateEntry,'-')) { + $Date_Array = explode('-',$DateEntry); + } elseif (strpos ($DateEntry,'.')) { + $Date_Array = explode('.',$DateEntry); + } elseif (strlen($DateEntry)==6) { + $Date_Array[0]= substr($DateEntry,0,2); + $Date_Array[1]= substr($DateEntry,2,2); + $Date_Array[2]= substr($DateEntry,4,2); + } elseif (strlen($DateEntry)==8) { + $Date_Array[0]= substr($DateEntry,0,4); + $Date_Array[1]= substr($DateEntry,4,2); + $Date_Array[2]= substr($DateEntry,6,2); + } + + if ($_SESSION['DefaultDateFormat']=='Y/m/d') { + if (strlen($Date_Array[0])==2) { + if ((int)$Date_Array[0] <=60) { + $Date_Array[0] = '20'.$Date_Array[2]; + } elseif ((int)$Date_Array[0] >60 AND (int)$Date_Array[2] <100) { + $Date_Array[0] = '19'.$Date_Array[2]; + } + } + + $DateStamp = mktime(0,0,0, $Date_Array[1]+1, 0, $Date_Array[0]); + + }elseif (($_SESSION['DefaultDateFormat']=='d/m/Y') OR $_SESSION['DefaultDateFormat']=='d.m.Y'){ + if (strlen($Date_Array[2])==2) { + if ((int)$Date_Array[2] <=60) { + $Date_Array[2] = '20'.$Date_Array[2]; + } elseif ((int)$Date_Array[2] >60 AND (int)$Date_Array[2] <100) { + $Date_Array[2] = '19'.$Date_Array[2]; + } + } + $DateStamp = mktime(0,0,0, $Date_Array[1]+1, 0, $Date_Array[2]); + + + } elseif ($_SESSION['DefaultDateFormat']=='m/d/Y') { + if (strlen($Date_Array[2])==2) { + if ((int)$Date_Array[2] <=60) { + $Date_Array[2] = '20'.$Date_Array[2]; + } elseif ((int)$Date_Array[2] >60 AND (int)$Date_Array[2] <100) { + $Date_Array[2] = '19'.$Date_Array[2]; + } + } + return $Date_Array[2].'-'.$Date_Array[0].'-'.$Date_Array[1]; + $DateStamp = mktime(0,0,0, $Date_Array[0]+1, 0, $Date_Array[2]); + } + return Date($_SESSION['DefaultDateFormat'],$DateStamp); +}// end of Last Day in the month function + + + function Date1GreaterThanDate2 ($Date1, $Date2) { /* returns true (1) if Date1 is greater than Date2 */ @@ -875,4 +933,5 @@ return $myrow[0]; } -?> + +?> \ No newline at end of file Modified: trunk/index.php =================================================================== --- trunk/index.php 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/index.php 2011-01-23 04:08:53 UTC (rev 4473) @@ -291,11 +291,6 @@ <table width="100%" class="table_index"> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/SelectCustomer.php?' . SID . '">' . _('Customer Transaction Inquiries') . '</a></p>'; ?> - </td> - </tr> - <tr> - <td class="menu_group_item"> <?php echo '<p>• <a href="' . $rootpath . '/CustWhereAlloc.php?' . SID . '">' . _('Where Allocated Inquiry') . '</a></p>'; ?> </td> </tr> @@ -327,11 +322,6 @@ </tr> <tr> <td class="menu_group_item"> - <?php echo '<p>• <a href="' . $rootpath . '/CustomerTransInquiry.php?' . SID . '">' . _('Transaction Inquiries') . '</a></p>'; ?> - </td> - </tr> - <tr> - <td class="menu_group_item"> <?php echo '<p>• <a href="' . $rootpath . '/PDFBankingSummary.php?' . SID . '">' . _('Re-Print A Deposit Listing') . '</a></p>'; ?> </td> </tr> @@ -357,6 +347,11 @@ </tr> <tr> <td class="menu_group_item"> + <?php echo '<p>• <a href="' . $rootpath . '/CustomerTransInquiry.php?' . SID . '">' . _('Customer Transaction Inquiries') . '</a></p>'; ?> + </td> + </tr> + <tr> + <td class="menu_group_item"> <?php echo GetRptLinks('ar'); ?> </td> </tr> @@ -1506,13 +1501,13 @@ $Title= array(_('Custom Reports'), _('Standard Reports and Forms')); - $sql= "SELECT id, - reporttype, - defaultreport, - groupname, + $sql= "SELECT id, + reporttype, + defaultreport, + groupname, reportname - FROM reports - ORDER BY groupname, + FROM reports + ORDER BY groupname, reportname"; $Result=DB_query($sql,$db,'','',false,true); $ReportList = ''; Modified: trunk/sql/mysql/upgrade3.11.1-4.00.sql =================================================================== --- trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-01-20 09:04:43 UTC (rev 4472) +++ trunk/sql/mysql/upgrade3.11.1-4.00.sql 2011-01-23 04:08:53 UTC (rev 4473) @@ -812,5 +812,5 @@ ALTER TABLE `purchorderdetails` CHANGE `gw` `kgs` VARCHAR( 50 ) DEFAULT ''; ALTER TABLE `purchorderdetails` ADD `conversionfactor` DOUBLE NOT NULL DEFAULT '1'; UPDATE config SET confvalue='3.12.3' WHERE confname='VersionNumber'; -ALTER TABLE `purchorderdetails` CHANGE `uom` `suppliersunit` VARCHAR( 50 ) +ALTER TABLE `purchorderdetails` CHANGE `uom` `suppliersunit` VARCHAR( 50 ); UPDATE config SET confvalue='3.12.31' WHERE confname='VersionNumber'; \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |