| 
     
      
      
      From: <dai...@us...> - 2014-01-03 23:01:47
      
     
   | 
Revision: 6527
          http://sourceforge.net/p/web-erp/reponame/6527
Author:   daintree
Date:     2014-01-03 23:01:44 +0000 (Fri, 03 Jan 2014)
Log Message:
-----------
Create CSV from inventory valuation rather than output to pdf
Modified Paths:
--------------
    trunk/InventoryValuation.php
    trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.po
Modified: trunk/InventoryValuation.php
===================================================================
--- trunk/InventoryValuation.php	2014-01-03 15:13:22 UTC (rev 6526)
+++ trunk/InventoryValuation.php	2014-01-03 23:01:44 UTC (rev 6527)
@@ -3,23 +3,13 @@
 /* $Id$ */
 
 include('includes/session.inc');
-
-if (isset($_POST['PrintPDF'])
+if ((isset($_POST['PrintPDF']) OR isset($_POST['CSV']))
 	AND isset($_POST['FromCriteria'])
 	AND mb_strlen($_POST['FromCriteria'])>=1
 	AND isset($_POST['ToCriteria'])
 	AND mb_strlen($_POST['ToCriteria'])>=1){
 
-	include('includes/PDFStarter.php');
-
-	$pdf->addInfo('Title',_('Inventory Valuation Report'));
-	$pdf->addInfo('Subject',_('Inventory Valuation'));
-	$FontSize=9;
-	$PageNumber=1;
-	$line_height=12;
-
-
-	/*Now figure out the inventory data to report for the category range under review */
+/*Now figure out the inventory data to report for the category range under review */
 	if ($_POST['Location']=='All'){
 		$SQL = "SELECT stockmaster.categoryid,
 					stockcategory.categorydescription,
@@ -85,6 +75,24 @@
 	   include('includes/footer.inc');
 	   exit;
 	}
+}
+
+if (isset($_POST['PrintPDF'])
+	AND isset($_POST['FromCriteria'])
+	AND mb_strlen($_POST['FromCriteria'])>=1
+	AND isset($_POST['ToCriteria'])
+	AND mb_strlen($_POST['ToCriteria'])>=1){
+
+	include('includes/PDFStarter.php');
+
+	$pdf->addInfo('Title',_('Inventory Valuation Report'));
+	$pdf->addInfo('Subject',_('Inventory Valuation'));
+	$FontSize=9;
+	$PageNumber=1;
+	$line_height=12;
+
+
+	
 	if (DB_num_rows($InventoryResult)==0){
 		$Title = _('Print Inventory Valuation Error');
 		include('includes/header.inc');
@@ -191,9 +199,24 @@
 
 	$pdf->OutputD($_SESSION['DatabaseName'] . '_Inventory_Valuation_' . Date('Y-m-d') . '.pdf');
 	$pdf->__destruct();
+	
+} elseif (isset($_POST['CSV'])) {
 
-} else { /*The option to print PDF was not hit */
+	$CSVListing = _('Category ID') .','. _('Category Description') .','. _('Stock ID') .','. _('Description') .','. _('Decimal Places') .','. _('Qty On Hand') .','. _('Units') .','. _('Unit Cost') .','. _('Total') . "\n";
+	while ($InventoryValn = DB_fetch_row($InventoryResult, $db)) {
+		$CSVListing .= implode(',', $InventoryValn) . "\n";
+	}
+	header('Content-Encoding: UTF-8');
+    header('Content-type: text/csv; charset=UTF-8');
+    header("Content-disposition: attachment; filename=InventoryValuation_Categories_" .  $_POST['FromCriteria']  . '-' .  $_POST['Toriteria']  .'.csv');
+    header("Pragma: public");
+    header("Expires: 0");
+    echo "\xEF\xBB\xBF"; // UTF-8 BOM
+	echo $CSVListing;
+	exit;
 
+} else { /*The option to print PDF nor to create the CSV was not hit */
+
 	$Title=_('Inventory Valuation Reporting');
 	include('includes/header.inc');
 
@@ -267,6 +290,7 @@
 			<br />
 			<div class="centre">
 				<input type="submit" name="PrintPDF" value="' . _('Print PDF') . '" />
+				<input type="submit" name="CSV" value="' . _('Output to CSV') . '" />
 			</div>';
         echo '</div>
               </form>';
@@ -274,4 +298,4 @@
 	include('includes/footer.inc');
 
 } /*end of else not PrintPDF */
-?>
\ No newline at end of file
+?>
Modified: trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.po
===================================================================
--- trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.po	2014-01-03 15:13:22 UTC (rev 6526)
+++ trunk/locale/pt_BR.utf8/LC_MESSAGES/messages.po	2014-01-03 23:01:44 UTC (rev 6527)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: WebERP 4.2112\n"
-"Report-Msgid-Bugs-To: <gs...@gm...>\n"
+"Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2013-12-01 20:34+1300\n"
 "PO-Revision-Date: 2013-12-24 23:41-0300\n"
 "Last-Translator: gilberto dos santos alves <gs...@gm...>\n"
@@ -22934,8 +22934,8 @@
 "Unable to determine the area where the sale is to, from the customer "
 "branches table, please select an area for this branch"
 msgstr ""
-"Incapaz de deteminar para qual área de vendas, da tabela de "
-"sucursais(filiais), por favor selecione uma area para esta filial"
+"Incapaz de deteminar para qual área de vendas, da tabela de sucursais"
+"(filiais), por favor selecione uma area para esta filial"
 
 #: RecurringSalesOrdersProcess.php:228
 msgid ""
@@ -32721,9 +32721,10 @@
 msgstr ""
 
 #: SystemParameters.php:478
+#, fuzzy
 msgid ""
-"Select all the languages for which item description translations are to be "
-"maintained."
+"Select the languages in which translations of the item description will be "
+"maintained. The default language is excluded."
 msgstr "Selecione os idiomas para o qual a descrição do item será mantida"
 
 #: SystemParameters.php:484
@@ -33034,12 +33035,14 @@
 msgstr "Permitido Sobre Taxa na Proporção"
 
 #: SystemParameters.php:706 SystemParameters.php:711
-msgid "The input must between 0~100"
+#, fuzzy
+msgid "The input must between 0 and 100"
 msgstr "Valor de ser entre 0 e 100"
 
 #: SystemParameters.php:706
-msgid "integer between 0-100"
-msgstr ""
+#, fuzzy
+msgid "integer between 0 and 100"
+msgstr "Um núm. entre 1 e 10 é esperado"
 
 #: SystemParameters.php:707
 msgid ""
@@ -33145,8 +33148,9 @@
 msgstr "Tamanho Pág. Relatório"
 
 #: SystemParameters.php:754
-msgid "The input should be between 1~999"
-msgstr ""
+#, fuzzy
+msgid "The input should be between 1 and 999"
+msgstr "registros devem ser entre 1 e 999"
 
 #: SystemParameters.php:754
 msgid " 1 to 999"
 |