|
From: <te...@us...> - 2012-07-17 06:08:02
|
Revision: 5511
http://web-erp.svn.sourceforge.net/web-erp/?rev=5511&view=rev
Author: tehonu
Date: 2012-07-17 06:07:56 +0000 (Tue, 17 Jul 2012)
Log Message:
-----------
Ricard: Changed loctransfer shipdate and recdate to datetime.
Modified Paths:
--------------
trunk/StockDispatch.php
trunk/StockLocTransfer.php
trunk/StockLocTransferReceive.php
trunk/includes/DateFunctions.inc
trunk/includes/PDFStockLocTransferHeader.inc
Modified: trunk/StockDispatch.php
===================================================================
--- trunk/StockDispatch.php 2012-07-16 17:49:22 UTC (rev 5510)
+++ trunk/StockDispatch.php 2012-07-17 06:07:56 UTC (rev 5511)
@@ -223,7 +223,7 @@
VALUES ('" . $Trf_ID . "',
'" . $myrow['stockid'] . "',
'" . $ShipQty . "',
- '" . Date('Y-m-d') . "',
+ '" . Date('Y-m-d H-i-s') . "',
'" . $_POST['FromLocation'] ."',
'" . $_POST['ToLocation'] . "')";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('Unable to enter Location Transfer record for'). ' '.$myrow['stockid'];
Modified: trunk/StockLocTransfer.php
===================================================================
--- trunk/StockLocTransfer.php 2012-07-16 17:49:22 UTC (rev 5510)
+++ trunk/StockLocTransfer.php 2012-07-17 06:07:56 UTC (rev 5511)
@@ -207,7 +207,7 @@
VALUES ('" . $_POST['Trf_ID'] . "',
'" . $_POST['StockID' . $i] . "',
'" . round(filter_number_format($_POST['StockQTY' . $i]), $DecimalRow['decimalplaces']) . "',
- '" . Date('Y-m-d') . "',
+ '" . Date('Y-m-d H-i-s'). "',
'" . $_POST['FromStockLocation'] ."',
'" . $_POST['ToStockLocation'] . "')";
$ErrMsg = _('CRITICAL ERROR') . '! ' . _('Unable to enter Location Transfer record for'). ' '.$_POST['StockID' . $i];
Modified: trunk/StockLocTransferReceive.php
===================================================================
--- trunk/StockLocTransferReceive.php 2012-07-16 17:49:22 UTC (rev 5510)
+++ trunk/StockLocTransferReceive.php 2012-07-17 06:07:56 UTC (rev 5511)
@@ -308,12 +308,12 @@
if ($TrfLine->CancelBalance==1){
$sql = "UPDATE loctransfers SET recqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "',
shipqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "',
- recdate = '".date('Y-m-d H:i:s'). "'
+ recdate = '".Date('Y-m-d H:i:s'). "'
WHERE reference = '". $_SESSION['Transfer']->TrfID . "'
AND stockid = '". $TrfLine->StockID."'";
} else {
$sql = "UPDATE loctransfers SET recqty = recqty + '". round($TrfLine->Quantity, $TrfLine->DecimalPlaces) . "',
- recdate = '".date('Y-m-d H:i:s'). "'
+ recdate = '".Date('Y-m-d H:i:s'). "'
WHERE reference = '". $_SESSION['Transfer']->TrfID . "'
AND stockid = '". $TrfLine->StockID."'";
}
@@ -562,7 +562,7 @@
}
echo '<td class="number">' . $myrow['reference'] . '</td>
<td>' . $myrow['trffromloc'] . '</td>
- <td>' . ConvertSQLDate($myrow['shipdate']) . '</td>
+ <td>' . ConvertSQLDateTime($myrow['shipdate']) . '</td>
<td><a href="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '?Trf_ID=' . $myrow['reference'] . '">'. _('Receive'). '</a></td>
</tr>';
}
Modified: trunk/includes/DateFunctions.inc
===================================================================
--- trunk/includes/DateFunctions.inc 2012-07-16 17:49:22 UTC (rev 5510)
+++ trunk/includes/DateFunctions.inc 2012-07-17 06:07:56 UTC (rev 5511)
@@ -267,6 +267,52 @@
} // end function ConvertSQLDate
+function ConvertSQLDateTime($DateEntry) {
+
+//for MySQL dates are in the format YYYY-mm-dd H:i:s
+
+
+ if (mb_strpos($DateEntry,'/')) {
+ $Date_Array = explode('/',$DateEntry);
+ } elseif (mb_strpos ($DateEntry,'-')) {
+ $Date_Array = explode('-',$DateEntry);
+ } elseif (mb_strpos ($DateEntry,'.')) {
+ $Date_Array = explode('.',$DateEntry);
+ } else {
+ prnMsg(_('The date does not appear to be in a valid format. The date being converted from SQL format was:') . ' ' . $DateEntry,'error');
+ switch ($_SESSION['DefaultDateFormat']) {
+ case 'd/m/Y':
+ return '0/0/000';
+ break;
+ case 'd.m.Y':
+ return '0.0.000';
+ break;
+ case 'm/d/Y':
+ return '0/0/0000';
+ break;
+ case 'Y/m/d':
+ return '0000/0/0';
+ break;
+ }
+ }
+
+ if (mb_strlen($Date_Array[2])>4) {
+ $Time = mb_substr($Date_Array[2],3,8);
+ $Date_Array[2]= mb_substr($Date_Array[2],0,2);
+ }
+
+ if ($_SESSION['DefaultDateFormat']=='d/m/Y'){
+ return $Date_Array[2].'/'.$Date_Array[1].'/'.$Date_Array[0] . ' ' . $Time;
+ } elseif ($_SESSION['DefaultDateFormat']=='d.m.Y'){
+ return $Date_Array[2].'.'.$Date_Array[1].'.'.$Date_Array[0] . ' ' . $Time;
+ } elseif ($_SESSION['DefaultDateFormat']=='m/d/Y'){
+ return $Date_Array[1].'/'.$Date_Array[2].'/'.$Date_Array[0] . ' ' . $Time;
+ } elseif ($_SESSION['DefaultDateFormat']=='Y/m/d'){
+ return $Date_Array[0].'/'.$Date_Array[1].'/'.$Date_Array[2] . ' ' . $Time;
+ }
+
+} // end function ConvertSQLDate
+
function SQLDateToEDI($DateEntry) {
//for MySQL dates are in the format YYYY-mm-dd
Modified: trunk/includes/PDFStockLocTransferHeader.inc
===================================================================
--- trunk/includes/PDFStockLocTransferHeader.inc 2012-07-16 17:49:22 UTC (rev 5510)
+++ trunk/includes/PDFStockLocTransferHeader.inc 2012-07-17 06:07:56 UTC (rev 5511)
@@ -19,7 +19,7 @@
$YPos -=15;
$FontSize=12;
$LeftOvers2 = $pdf->addTextWrap($Left_Margin,$YPos,550,$FontSize,
-_('Shipped'). ' ' . ConvertSQLDate($TransferRow['shipdate']));
+_('Shipped'). ' ' . ConvertSQLDateTime($TransferRow['shipdate']));
$YPos -=15;
$FontSize=12;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|